Skip to content

Commit 46676ab

Browse files
authored
Allow all frosh to vote (please test this) (#372)
* Allow all frosh to vote (please test this) * fixed my stupidity
1 parent a669ecf commit 46676ab

File tree

5 files changed

+6
-26
lines changed

5 files changed

+6
-26
lines changed

packet/commands.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ def remove_sig(packet_id: int, username: str, is_member: bool) -> None:
194194
db.session.commit()
195195
print('Successfully unsigned packet')
196196
else:
197-
print('Failed to unsign packet; {} is not an onfloor'.format(username))
197+
print('Failed to unsign packet; could not find signature')
198198

199199

200200
@app.cli.command('remove-member-sig')

packet/routes/shared.py

-7
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,6 @@ def freshman_packet(packet_id, info=None):
2727
if packet is None:
2828
return 'Invalid packet or freshman', 404
2929
else:
30-
can_sign = packet.is_open()
31-
32-
# If the packet is open and the user is an off-floor freshman set can_sign to False
33-
if packet.is_open() and app.config['REALM'] != 'csh':
34-
if info['uid'] not in map(lambda sig: sig.freshman_username, packet.fresh_signatures):
35-
can_sign = False
3630

3731
# The current user's freshman signature on this packet
3832
fresh_sig = list(filter(
@@ -43,7 +37,6 @@ def freshman_packet(packet_id, info=None):
4337
return render_template('packet.html',
4438
info=info,
4539
packet=packet,
46-
can_sign=can_sign,
4740
did_sign=packet.did_sign(info['uid'], app.config['REALM'] == 'csh'),
4841
required=packet.signatures_required(),
4942
received=packet.signatures_received(),

packet/templates/active_packets.html

+1-6
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ <h4 class="page-title">Active Packets</h4>
2020
</div>
2121
<div id="eval-blocks">
2222
{% if packets|length > 0 %}
23-
{% set can_sign = info.onfloor or info.realm == "csh" %}
2423
<div id="eval-table">
2524
<div class="card">
2625
<div class="card-body table-fill">
@@ -34,9 +33,7 @@ <h4 class="page-title">Active Packets</h4>
3433
<th>Signatures</th>
3534
<th>Signatures</th>
3635
{% endif %}
37-
{% if can_sign %}
38-
<th>Sign</th>
39-
{% endif %}
36+
<th>Sign</th>
4037
</tr>
4138
</thead>
4239
<tbody>
@@ -77,7 +74,6 @@ <h4 class="page-title">Active Packets</h4>
7774
{% endif %}
7875
</td>
7976
{% endif %}
80-
{% if can_sign %}
8177
<td class="sign-packet" align="right" data-priority="1">
8278
{% if not packet.did_sign_result and info.ritdn != packet.freshman_username %}
8379
<button class="btn btn-sm btn-primary sign-button"
@@ -92,7 +88,6 @@ <h4 class="page-title">Active Packets</h4>
9288
</button>
9389
{% endif %}
9490
</td>
95-
{% endif %}
9691
</tr>
9792
{% endfor %}
9893
</tbody>

packet/templates/packet.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<h3>{{ get_rit_name(packet.freshman_username) }}</h3>
1111
</div>
1212
<div class="col">
13-
{% if can_sign and not did_sign %}
13+
{% if not did_sign %}
1414
<button class="btn btn-primary sign-button"
1515
data-packet_id="{{ packet.id }}"
1616
data-freshman_name="{{ get_rit_name(packet.freshman_username) }}">Sign
@@ -105,7 +105,7 @@ <h5>Upperclassmen Score - {{ '%0.2f' % upper_score }}%</h5>
105105
</div>
106106
</div>
107107
{% endif %}
108-
{% if info.is_upper or packet.freshman_username == info.ritdn or can_sign %}
108+
{% if info.is_upper or packet.freshman_username == info.ritdn %}
109109
<div class="card mb-2">
110110
<div class="card-header">
111111
<b>On-Floor Freshmen Signatures</b>

packet/utils.py

+2-10
Original file line numberDiff line numberDiff line change
@@ -150,16 +150,9 @@ def sync_freshman(freshmen_list: dict) -> None:
150150

151151
# Update the freshmen signatures of each open or future packet
152152
for packet in Packet.query.filter(Packet.end > datetime.now()).all():
153-
# Handle the freshmen that are no longer onfloor
154-
for fresh_sig in filter(lambda fresh_sig: not fresh_sig.freshman.onfloor, packet.fresh_signatures):
155-
FreshSignature.query.filter_by(packet_id=fresh_sig.packet_id,
156-
freshman_username=fresh_sig.freshman_username).delete()
157-
158-
# Add any new onfloor freshmen
159153
# pylint: disable=cell-var-from-loop
160154
current_fresh_sigs = set(map(lambda fresh_sig: fresh_sig.freshman_username, packet.fresh_signatures))
161155
for list_freshman in filter(lambda list_freshman: list_freshman.rit_username not in current_fresh_sigs and
162-
list_freshman.onfloor and
163156
list_freshman.rit_username != packet.freshman_username,
164157
freshmen_list.values()):
165158
db.session.add(FreshSignature(packet=packet, freshman=freshmen_in_db[list_freshman.rit_username]))
@@ -207,9 +200,8 @@ def create_new_packets(base_date: date, freshmen_list: dict) -> None:
207200
sig.drink_admin = member.uid in drink
208201
db.session.add(sig)
209202

210-
for onfloor_freshman in Freshman.query.filter_by(onfloor=True).filter(Freshman.rit_username !=
211-
freshman.rit_username).all():
212-
db.session.add(FreshSignature(packet=packet, freshman=onfloor_freshman))
203+
for frosh in Freshman.query.filter_by(Freshman.rit_username != freshman.rit_username).all():
204+
db.session.add(FreshSignature(packet=packet, freshman=frosh))
213205

214206
db.session.commit()
215207

0 commit comments

Comments
 (0)