Skip to content

Commit 798dfeb

Browse files
committedNov 1, 2024·
1 parent 936e2f6 commit 798dfeb

File tree

5 files changed

+110
-3
lines changed

5 files changed

+110
-3
lines changed
 

‎magprime/config.py

+4
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ def SEASON_BADGE_PRICE(self):
1919
@property
2020
def SEASON_EVENTS(self):
2121
return config['season_events']
22+
23+
@property
24+
def SUPERSTAR_MINIMUM(self):
25+
return list(c.SUPERSTAR_DONATIONS.keys())[1]
2226

2327
@property
2428
def PREREG_BADGE_TYPES(self):

‎magprime/models.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,10 @@ def check_in_notes(self):
8383

8484
@presave_adjustment
8585
def set_superstar_ribbon(self):
86-
if self.extra_donation >= 30 and c.SUPERSTAR_RIBBON not in self.ribbon_ints:
86+
if self.extra_donation >= c.SUPERSTAR_MINIMUM and c.SUPERSTAR_RIBBON not in self.ribbon_ints:
8787
self.ribbon = add_opt(self.ribbon_ints, c.SUPERSTAR_RIBBON)
88-
elif self.extra_donation < 30 and self.orig_value_of('extra_donation') >= 30 and c.SUPERSTAR_RIBBON in self.ribbon_ints:
88+
elif self.extra_donation < c.SUPERSTAR_MINIMUM and \
89+
self.orig_value_of('extra_donation') >= c.SUPERSTAR_MINIMUM and c.SUPERSTAR_RIBBON in self.ribbon_ints:
8990
self.ribbon = remove_opt(self.ribbon_ints, c.SUPERSTAR_RIBBON)
9091

9192
@presave_adjustment

‎magprime/site_sections/magprime_reports.py

+35
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from sqlalchemy.orm import subqueryload
66

77
from uber.config import c
8+
from uber.custom_tags import datetime_local_filter
89
from uber.decorators import all_renderable, csv_file, department_id_adapter
910
from uber.models import Attendee, Shift, RoomAssignment
1011

@@ -66,6 +67,40 @@ def label(s):
6667
'counts': counts,
6768
}
6869

70+
def superstars(self, session):
71+
counts = {}
72+
owe_money = {}
73+
superstars = session.valid_attendees().filter(Attendee.extra_donation >= c.SUPERSTAR_MINIMUM)
74+
75+
valid_donations_list = c.SUPERSTAR_DONATION_OPTS[1:-1]
76+
last_index = len(valid_donations_list) - 1
77+
for index, opt in enumerate(valid_donations_list):
78+
amt, label = opt
79+
count_query = session.valid_attendees().filter(Attendee.extra_donation >= amt)
80+
if index != last_index:
81+
next_amt, next_label = valid_donations_list[index + 1]
82+
count_query = count_query.filter(Attendee.extra_donation < next_amt)
83+
counts[label] = count_query.count()
84+
85+
for attendee in [a for a in superstars if a.amount_unpaid]:
86+
owe_money[attendee.id] = attendee.amount_unpaid
87+
88+
return {
89+
'attendees': superstars,
90+
'counts': counts,
91+
'owe_money': owe_money,
92+
'total_count': superstars.count(),
93+
}
94+
95+
@csv_file
96+
def superstars_csv(self, out, session):
97+
out.writerow(["Group Name", "Full Name", "Name on ID", "Badge Name", "Badge Type", "Ribbons", "Pre-ordered Merch",
98+
"Email", "ZIP/Postal Code", "Checked In"])
99+
for a in session.valid_attendees().filter(Attendee.extra_donation >= c.SUPERSTAR_MINIMUM):
100+
out.writerow([a.group_name, a.full_name, a.legal_name, a.badge_printed_name, a.badge_type_label,
101+
' / '.join(a.ribbon_labels), a.amount_extra_label, a.email, a.zip_code,
102+
datetime_local_filter(a.checked_in)])
103+
69104
@csv_file
70105
def donated_badge_attendees(self, out, session):
71106
out.writerow(["Full Name", "Legal Name", "Email", "Phone #", "Amount Paid", "Amount Unpaid", "Kick-In Level",

‎magprime/templates/emails/reg_workflow/attendee_confirmation.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
Thank you so much for your support! Your employer may match your contributions to charitable organizations,
4949
so be sure to ask them. Donations over $250 will receive a donation receipt later this year. If you require a
5050
receipt, but donated less than $250, please email {{ "accounting@magfest.org"|email_to_link }} to request one.
51-
{% if attendee.extra_donation > 30 %}Even cooler, you are now a proud MAGFest Superstar! Check out our <a href="http://magfest.org/superstars">Superstars page</a> for more details on your perks.{% endif %}
51+
{% if attendee.extra_donation > c.SUPERSTAR_MINIMUM %}Even cooler, you are now a proud MAGFest Superstar! Check out our <a href="http://magfest.org/superstars">Superstars page</a> for more details on your perks.{% endif %}
5252
{% endif %}
5353

5454
{% if attendee.addons %}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
{% extends "uber/templates/base.html" %}{% set admin_area=True %}
2+
{% set title = "Super MAGFest Superstars Report" %}
3+
{% block content %}
4+
<h2 class="center">Super MAGFest Superstars Report</h2>
5+
6+
<div class="card">
7+
<div class="card-header">Superstar Counts</div>
8+
<div class="card-body">
9+
<p><strong>{{ total_count }}</strong> Superstars total</p>
10+
<p>Superstar level counts:
11+
<ul>
12+
{% for label, count in counts.items() %}
13+
<li><strong>{{ label }}</strong>: {{ count }}</li>
14+
{% endfor %}
15+
</ul>
16+
The counts above include all donations up to but not including the next donation level.
17+
</p>
18+
</div>
19+
</div>
20+
<br/>
21+
<div class="card">
22+
<div class="card-header">Superstar Attendees</div>
23+
<div class="card-body">
24+
<p><a href="superstars_csv"><i class="fa fa-download"></i> Download CSV</a></p>
25+
<table class="table table-striped datatable">
26+
<thead>
27+
<th>Group</th>
28+
<th>Name</th>
29+
<th>Name on Photo ID</th>
30+
<th>Badge Name</th>
31+
<th>Badge Type</th>
32+
<th>Ribbons</th>
33+
<th>Pre-ordered Merch</th>
34+
<th>Email Address</th>
35+
<th>Zip Code</th>
36+
<th>Paid?</th>
37+
<th>Checked In?</th>
38+
</thead>
39+
<tbody>
40+
{% for attendee in attendees %}
41+
<tr>
42+
<td data-sort="{{ attendee.group.name if attendee.group else '' }}">
43+
{{ attendee.group|form_link if attendee.group else "N/A" }}
44+
</td>
45+
<td data-sort="{{ attendee.last_first }}">{{ attendee|form_link }}</td>
46+
<td>{{ attendee.legal_name }}</td>
47+
<td>{{ attendee.badge_printed_name }}</td>
48+
<td>{{ attendee.badge_type_label }}</td>
49+
<td>{{ attendee.ribbon_labels|join(", ") }}</td>
50+
<td>{{ attendee.amount_extra_label }}</td>
51+
<td>{{ attendee.email_address }}</td>
52+
<td>{{ attendee.zip_code }}</td>
53+
<td data-sort="{{ owe_money[attendee.id] if attendee.id in owe_money else '0' }}">
54+
{% if owe_money[attendee.id] %}No (owes {{ owe_money[attendee.id]|format_currency }})
55+
{% else %}Yes{% endif %}
56+
</td>
57+
<td data-sort="{{ attendee.checked_in|full_datetime_local }}">
58+
{{ hour_day_local(attendee.checked_in) }}
59+
</td>
60+
</tr>
61+
{% endfor %}
62+
</tbody>
63+
</table>
64+
</div>
65+
</div>
66+
67+
{% endblock %}

0 commit comments

Comments
 (0)
Please sign in to comment.