Compare commits

..

No commits in common. "bd1e009cc26c8a7508ebe03770d176009ee59c5f" and "dcf483d19ee38e01e2fa89bd99eb271e04f4a7f0" have entirely different histories.

View File

@ -21,37 +21,27 @@ class EventSurveyEmail(TemplatedMultipartEmail):
template = "membershipworks/email/event_survey.dj.html" template = "membershipworks/email/event_survey.dj.html"
@classmethod @staticmethod
def render_for_event(cls, event: EventExt) -> Iterable[mail.EmailMessage]: def survey_url(event: EventExt, attendee_name: str, attendee_email: str) -> str:
# not using event.attendees because that makes getting ticket count harder return "https://claremontmakerspace.org/class-evaluation-form?" + urlencode(
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 = (
"https://claremontmakerspace.org/class-evaluation-form?"
+ urlencode(
{ {
"event_id": event.eid, "event_id": event.eid,
"instructor_name": ( "instructor_name": str(event.instructor) if event.instructor else "",
str(event.instructor) if event.instructor else ""
),
"event_name": event.title, "event_name": event.title,
"event_date": event.start.strftime("%Y-%m-%d %H:%M:%S"), "event_date": event.start.strftime("%Y-%m-%d %H:%M:%S"),
"participant_name": name, "participant_name": attendee_name,
"participant_email": email, "participant_email": attendee_email,
}, },
quote_via=quote, quote_via=quote,
) )
)
@classmethod
def render_for_event(cls, event: EventExt) -> Iterable[mail.EmailMessage]:
for name, email in event.attendees.values_list("name", "email"):
sanitized_email = mail.message.sanitize_address(
(name, email), settings.DEFAULT_CHARSET
)
survey_url = cls.survey_url(event, name, email)
yield cls.render( yield cls.render(
{"event": event, "attendee_name": name, "survey_url": survey_url}, {"event": event, "attendee_name": name, "survey_url": survey_url},
to=[sanitized_email], to=[sanitized_email],