<commit_before>from panels import *

AutomatedEmail.queries[PanelApplication] = lambda session: session.query(PanelApplication)

_attendee_query = AutomatedEmail.queries[Attendee]
AutomatedEmail.queries[Attendee] = lambda session: _attendee_query(session).options(subqueryload(Attendee.assigned_panelists))


class PanelAppEmail(AutomatedEmail):
    def __init__(self, subject, template, filter, ident, **kwargs):
        AutomatedEmail.__init__(self, PanelApplication, subject, template,
                                lambda app: (not app.poc_id or app.poc.badge_type != c.GUEST_BADGE) and filter(app),
                                ident, sender=c.PANELS_EMAIL, **kwargs)

    def computed_subject(self, x):
        return self.subject.replace('<PANEL_NAME>', x.name)


PanelAppEmail('Your {EVENT_NAME} Panel Application Has Been Received: <PANEL_NAME>', 'panel_app_confirmation.txt',
              lambda a: True,
              needs_approval=False,
              ident='panel_received')

PanelAppEmail('Your {EVENT_NAME} Panel Application Has Been Accepted: <PANEL_NAME>', 'panel_app_accepted.txt',
              lambda app: app.status == c.ACCEPTED,
              ident='panel_accepted')

PanelAppEmail('Your {EVENT_NAME} Panel Application Has Been Declined: <PANEL_NAME>', 'panel_app_declined.txt',
              lambda app: app.status == c.DECLINED,
              ident='panel_declined')

PanelAppEmail('Your {EVENT_NAME} Panel Application Has Been Waitlisted: <PANEL_NAME>', 'panel_app_waitlisted.txt',
              lambda app: app.status == c.WAITLISTED,
              ident='panel_waitlisted')

PanelAppEmail('Your {EVENT_NAME} Panel Has Been Scheduled: <PANEL_NAME>', 'panel_app_scheduled.txt',
              lambda app: app.event_id,
              ident='panel_scheduled')

AutomatedEmail(Attendee, 'Your {EVENT_NAME} Event Schedule', 'panelist_schedule.txt',
               lambda a: (not a.poc_id or a.poc.badge_type != c.GUEST_BADGE) and a.assigned_panelists,
               ident='event_schedule',
               sender=c.PANELS_EMAIL)<commit_msg>Fix email sending error Removes attempts to access a property on the Attendee model that doesn't exist (it exists only on the PanelApplication model).<commit_after>from panels import *

AutomatedEmail.queries[PanelApplication] = lambda session: session.query(PanelApplication)

_attendee_query = AutomatedEmail.queries[Attendee]
AutomatedEmail.queries[Attendee] = lambda session: _attendee_query(session).options(subqueryload(Attendee.assigned_panelists))


class PanelAppEmail(AutomatedEmail):
    def __init__(self, subject, template, filter, ident, **kwargs):
        AutomatedEmail.__init__(self, PanelApplication, subject, template,
                                lambda app: (not app.poc_id or app.poc.badge_type != c.GUEST_BADGE) and filter(app),
                                ident, sender=c.PANELS_EMAIL, **kwargs)

    def computed_subject(self, x):
        return self.subject.replace('<PANEL_NAME>', x.name)


PanelAppEmail('Your {EVENT_NAME} Panel Application Has Been Received: <PANEL_NAME>', 'panel_app_confirmation.txt',
              lambda a: True,
              needs_approval=False,
              ident='panel_received')

PanelAppEmail('Your {EVENT_NAME} Panel Application Has Been Accepted: <PANEL_NAME>', 'panel_app_accepted.txt',
              lambda app: app.status == c.ACCEPTED,
              ident='panel_accepted')

PanelAppEmail('Your {EVENT_NAME} Panel Application Has Been Declined: <PANEL_NAME>', 'panel_app_declined.txt',
              lambda app: app.status == c.DECLINED,
              ident='panel_declined')

PanelAppEmail('Your {EVENT_NAME} Panel Application Has Been Waitlisted: <PANEL_NAME>', 'panel_app_waitlisted.txt',
              lambda app: app.status == c.WAITLISTED,
              ident='panel_waitlisted')

PanelAppEmail('Your {EVENT_NAME} Panel Has Been Scheduled: <PANEL_NAME>', 'panel_app_scheduled.txt',
              lambda app: app.event_id,
              ident='panel_scheduled')

AutomatedEmail(Attendee, 'Your {EVENT_NAME} Event Schedule', 'panelist_schedule.txt',
               lambda a: a.badge_type != c.GUEST_BADGE and a.assigned_panelists,
               ident='event_schedule',
               sender=c.PANELS_EMAIL)
{'fraction_non_alphanumeric': 0.103505057633498, 'fraction_numerical': 0.0, 'mean_word_length': 3.4291666666666667, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2330139', 'n_tokens_mistral': 1275, 'n_tokens_neox': 1278, 'n_words': 277}