diff --git a/packet/commands.py b/packet/commands.py index ea3591a..31f9590 100644 --- a/packet/commands.py +++ b/packet/commands.py @@ -194,7 +194,7 @@ def remove_sig(packet_id: int, username: str, is_member: bool) -> None: db.session.commit() print('Successfully unsigned packet') else: - print('Failed to unsign packet; {} is not an onfloor'.format(username)) + print('Failed to unsign packet; could not find signature') @app.cli.command('remove-member-sig') diff --git a/packet/routes/shared.py b/packet/routes/shared.py index 3508faa..bd671bf 100644 --- a/packet/routes/shared.py +++ b/packet/routes/shared.py @@ -27,12 +27,6 @@ def freshman_packet(packet_id, info=None): if packet is None: return 'Invalid packet or freshman', 404 else: - can_sign = packet.is_open() - - # If the packet is open and the user is an off-floor freshman set can_sign to False - if packet.is_open() and app.config['REALM'] != 'csh': - if info['uid'] not in map(lambda sig: sig.freshman_username, packet.fresh_signatures): - can_sign = False # The current user's freshman signature on this packet fresh_sig = list(filter( @@ -43,7 +37,6 @@ def freshman_packet(packet_id, info=None): return render_template('packet.html', info=info, packet=packet, - can_sign=can_sign, did_sign=packet.did_sign(info['uid'], app.config['REALM'] == 'csh'), required=packet.signatures_required(), received=packet.signatures_received(), diff --git a/packet/templates/active_packets.html b/packet/templates/active_packets.html index bd8fdc3..930d736 100644 --- a/packet/templates/active_packets.html +++ b/packet/templates/active_packets.html @@ -20,7 +20,6 @@

Active Packets

{% if packets|length > 0 %} - {% set can_sign = info.onfloor or info.realm == "csh" %}
@@ -34,9 +33,7 @@

Active Packets

Signatures Signatures {% endif %} - {% if can_sign %} - Sign - {% endif %} + Sign @@ -77,7 +74,6 @@

Active Packets

{% endif %} {% endif %} - {% if can_sign %} {% if not packet.did_sign_result and info.ritdn != packet.freshman_username %} {% endif %} - {% endif %} {% endfor %} diff --git a/packet/templates/packet.html b/packet/templates/packet.html index f2bb98a..c32658b 100644 --- a/packet/templates/packet.html +++ b/packet/templates/packet.html @@ -10,7 +10,7 @@

{{ get_rit_name(packet.freshman_username) }}

- {% if can_sign and not did_sign %} + {% if not did_sign %}
{% endif %} - {% if info.is_upper or packet.freshman_username == info.ritdn or can_sign %} + {% if info.is_upper or packet.freshman_username == info.ritdn %}
On-Floor Freshmen Signatures diff --git a/packet/utils.py b/packet/utils.py index a6e9158..278bb6c 100644 --- a/packet/utils.py +++ b/packet/utils.py @@ -150,16 +150,9 @@ def sync_freshman(freshmen_list: dict) -> None: # Update the freshmen signatures of each open or future packet for packet in Packet.query.filter(Packet.end > datetime.now()).all(): - # Handle the freshmen that are no longer onfloor - for fresh_sig in filter(lambda fresh_sig: not fresh_sig.freshman.onfloor, packet.fresh_signatures): - FreshSignature.query.filter_by(packet_id=fresh_sig.packet_id, - freshman_username=fresh_sig.freshman_username).delete() - - # Add any new onfloor freshmen # pylint: disable=cell-var-from-loop current_fresh_sigs = set(map(lambda fresh_sig: fresh_sig.freshman_username, packet.fresh_signatures)) for list_freshman in filter(lambda list_freshman: list_freshman.rit_username not in current_fresh_sigs and - list_freshman.onfloor and list_freshman.rit_username != packet.freshman_username, freshmen_list.values()): 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: sig.drink_admin = member.uid in drink db.session.add(sig) - for onfloor_freshman in Freshman.query.filter_by(onfloor=True).filter(Freshman.rit_username != - freshman.rit_username).all(): - db.session.add(FreshSignature(packet=packet, freshman=onfloor_freshman)) + for frosh in Freshman.query.filter_by(Freshman.rit_username != freshman.rit_username).all(): + db.session.add(FreshSignature(packet=packet, freshman=frosh)) db.session.commit()