Compare commits
2 Commits
dcf483d19e
...
bd1e009cc2
Author | SHA1 | Date | |
---|---|---|---|
bd1e009cc2 | |||
350dc4e1ee |
@ -21,27 +21,37 @@ class EventSurveyEmail(TemplatedMultipartEmail):
|
||||
|
||||
template = "membershipworks/email/event_survey.dj.html"
|
||||
|
||||
@staticmethod
|
||||
def survey_url(event: EventExt, attendee_name: str, attendee_email: str) -> str:
|
||||
return "https://claremontmakerspace.org/class-evaluation-form?" + urlencode(
|
||||
{
|
||||
"event_id": event.eid,
|
||||
"instructor_name": str(event.instructor) if event.instructor else "",
|
||||
"event_name": event.title,
|
||||
"event_date": event.start.strftime("%Y-%m-%d %H:%M:%S"),
|
||||
"participant_name": attendee_name,
|
||||
"participant_email": attendee_email,
|
||||
},
|
||||
quote_via=quote,
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def render_for_event(cls, event: EventExt) -> Iterable[mail.EmailMessage]:
|
||||
for name, email in event.attendees.values_list("name", "email"):
|
||||
# not using event.attendees because that makes getting ticket count harder
|
||||
for attendee in event.details["usr"]:
|
||||
# skip users with no tickets, as they were Voided
|
||||
if sum(attendee["tkt"]) == 0:
|
||||
continue
|
||||
|
||||
name = attendee["nam"]
|
||||
email = attendee["eml"]
|
||||
|
||||
sanitized_email = mail.message.sanitize_address(
|
||||
(name, email), settings.DEFAULT_CHARSET
|
||||
)
|
||||
survey_url = cls.survey_url(event, name, email)
|
||||
survey_url = (
|
||||
"https://claremontmakerspace.org/class-evaluation-form?"
|
||||
+ urlencode(
|
||||
{
|
||||
"event_id": event.eid,
|
||||
"instructor_name": (
|
||||
str(event.instructor) if event.instructor else ""
|
||||
),
|
||||
"event_name": event.title,
|
||||
"event_date": event.start.strftime("%Y-%m-%d %H:%M:%S"),
|
||||
"participant_name": name,
|
||||
"participant_email": email,
|
||||
},
|
||||
quote_via=quote,
|
||||
)
|
||||
)
|
||||
|
||||
yield cls.render(
|
||||
{"event": event, "attendee_name": name, "survey_url": survey_url},
|
||||
to=[sanitized_email],
|
||||
|
Loading…
Reference in New Issue
Block a user