Skip to content

Commit

Permalink
Merge pull request #4293 from magfest/various-fixes
Browse files Browse the repository at this point in the history
Fixes for dealer badge conversion, email reports, and admin shift schedule
  • Loading branch information
kitsuta authored Nov 29, 2023
2 parents 8030ee1 + 86fe154 commit 5d00983
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 16 deletions.
6 changes: 4 additions & 2 deletions uber/model_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -989,7 +989,8 @@ def no_more_child_badges(attendee):

@prereg_validation.Attendee
def child_badge_over_13(attendee):
if not attendee.is_new and not attendee.badge_status == c.PENDING_STATUS:
if not attendee.is_new and not attendee.badge_status == c.PENDING_STATUS \
or attendee.unassigned_group_reg or attendee.valid_placeholder:
return

if c.CHILD_BADGE in c.PREREG_BADGE_TYPES and attendee.birthdate and attendee.badge_type == c.CHILD_BADGE \
Expand All @@ -1000,7 +1001,8 @@ def child_badge_over_13(attendee):

@prereg_validation.Attendee
def attendee_badge_under_13(attendee):
if not attendee.is_new and not attendee.badge_status == c.PENDING_STATUS:
if not attendee.is_new and not attendee.badge_status == c.PENDING_STATUS \
or attendee.unassigned_group_reg or attendee.valid_placeholder:
return

if c.CHILD_BADGE in c.PREREG_BADGE_TYPES and attendee.birthdate and attendee.badge_type == c.ATTENDEE_BADGE \
Expand Down
11 changes: 5 additions & 6 deletions uber/site_sections/dealer_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,9 @@ def decline_and_convert_dealer_group(session, group, status=c.DECLINED, admin_no
"""
if not admin_note:
if delete_group:
admin_note = f'Converted badge from {AdminAccount.admin_name()} declining and converting {c.DEALER_REG_TERM} "{group.name}.'
admin_note = f'Converted badge from {AdminAccount.admin_name() or "server admin"} declining and converting {c.DEALER_REG_TERM} "{group.name}".'
else:
admin_note = f'Converted badge from {AdminAccount.admin_name()} setting {c.DEALER_REG_TERM} "{group.name}" to {c.DEALER_STATUS[status]}.'

admin_note = f'Converted badge from {AdminAccount.admin_name() or "non-admin"} setting {c.DEALER_REG_TERM} "{group.name}" to {c.DEALER_STATUS[status]}.'
if not group.is_unpaid:
group.tables = 0
for attendee in group.attendees:
Expand Down Expand Up @@ -102,12 +101,14 @@ def decline_and_convert_dealer_group(session, group, status=c.DECLINED, admin_no
attendee.badge_status = c.INVALID_GROUP_STATUS

if delete_group:
group.attendees.remove(attendee)
attendee.group = None
attendee.group_id = None

session.add(attendee)
session.commit()

if delete_group:
group.leader = None
session.delete(group)
else:
group.status = status
Expand All @@ -116,10 +117,8 @@ def decline_and_convert_dealer_group(session, group, status=c.DECLINED, admin_no
(badges_converted, '{} badge{} converted'),
(emails_sent, '{} email{} sent'),
(emails_failed, '{} email{} failed to send')]:

if count > 0:
message.append(template.format(count, pluralize(count)))

return ', '.join(message)


Expand Down
6 changes: 3 additions & 3 deletions uber/tasks/registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def check_duplicate_registrations():
for a in paid:
a.badge_status = c.NEW_STATUS

if dupes:
if dupes and session.no_email(subject):
body = render('emails/daily_checks/duplicates.html', {'dupes': sorted(dupes.items())}, encoding=None)
send_email.delay(c.ADMIN_EMAIL, c.REGDESK_EMAIL, subject, body, format='html', model='n/a')

Expand Down Expand Up @@ -118,7 +118,8 @@ def check_pending_badges():
subject = c.EVENT_NAME + ' Pending {} Badge Report for ' + localized_now().strftime('%Y-%m-%d')
with Session() as session:
for badge_type, to, per_email_filter, site_section in emails:
pending = session.query(Attendee).filter_by(badge_status=c.PENDING_STATUS).filter(per_email_filter).all()
pending = session.query(Attendee).filter_by(badge_status=c.PENDING_STATUS).filter(Attendee.paid != c.PENDING,
per_email_filter).all()
if pending and session.no_email(subject.format(badge_type)):
body = render('emails/daily_checks/pending.html', {'pending': pending, 'site_section': site_section}, encoding=None)
send_email.delay(c.ADMIN_EMAIL, to, subject.format(badge_type), body, format='html', model='n/a')
Expand Down Expand Up @@ -196,7 +197,6 @@ def email_pending_attendees():

if c.ATTENDEE_ACCOUNTS_ENABLED:
already_emailed_accounts.append(email_to)



@celery.schedule(timedelta(minutes=30))
Expand Down
2 changes: 1 addition & 1 deletion uber/templates/emails/daily_checks/pending.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<head></head>
<body>
<h3>{{ pending|length }} badges are currently pending</h3>
Use the <a href="{{ c.URL_BASE}}/{{ site_section }}/pending_badges">pending badges</a> badge to review and approve these badges.
Use the <a href="{{ c.URL_BASE}}/{{ site_section }}/pending_badges">pending badges</a> page to review and approve these badges.
<ul style="margin-top:0px ; margin-bottom:10px">
{% for attendee in pending %}
<li>
Expand Down
2 changes: 1 addition & 1 deletion uber/templates/emails/dealers/badge_converted.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{{ attendee.first_name }},

<br/><br/>Although your group ({{ group.name }}) {{ 'cancelled their ' + c.DEALER_APP_TERM if group.status == c.CANCELLED else ('was declined' if group.status == c.DECLINED else 'was not taken off the waitlist') }}, we think you may still want to come and enjoy all that {{ c.EVENT_NAME }} has to offer!
Therefore, we have reserved a badge for you{% if c.PRICE_BUMPS and attendee.badge_cost < c.BADGE_PRICE %} at the price of registration when you first applied{% endif %}.
Therefore, we have reserved a badge for you{% if c.PRICE_BUMPS and attendee.badge_cost and attendee.badge_cost < c.BADGE_PRICE %} at the price of registration when you first applied{% endif %}.
Badges went to anyone in your group who had a valid email on the badge, and any unassigned badges were dropped.

<br/><br/>Please note: You are choosing to accept or decline an ATTENDEE badge at the price it would have been had you bought it instead of applying for the {{ c.DEALER_LOC_TERM }}.
Expand Down
2 changes: 1 addition & 1 deletion uber/templates/preregistration/disclaimers.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
{% if c.CONSENT_FORM_URL %}
<li>
Attendees under 18 MUST bring a
<a href="http://super.magfest.org/parentalconsentform" target="_blank">signed parental consent form</a>,
<a href="{{ c.CONSENT_FORM_URL }}" target="_blank">signed parental consent form</a>,
which MUST be notarized if the parent is not with the minor when the
badge is picked up. Also, all children 12 and under will need to be
accompanied by an adult with a paid badge.
Expand Down
4 changes: 2 additions & 2 deletions uber/templates/shifts_admin/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ <h3>Teardown Shifts ({{teardown|length}})</h3>
agendaEvent: {
type: 'timeGrid',
visibleRange: {
start: '{{ c.EPOCH.strftime('%Y-%m-%d') }}',
end: '{{ c.ESCHATON.strftime('%Y-%m-%d') }}'
start: '{{ c.EPOCH }}',
end: '{{ c.ESCHATON }}'
},
buttonText: 'Event',
},
Expand Down

0 comments on commit 5d00983

Please sign in to comment.