From 2ccee27e444542159338e3f77f3bd72c57be7e20 Mon Sep 17 00:00:00 2001 From: Sam Cordry Date: Thu, 5 Sep 2024 17:24:29 -0400 Subject: [PATCH 1/6] change packet sorting to percentage --- packet/templates/include/admin/open_packets.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packet/templates/include/admin/open_packets.html b/packet/templates/include/admin/open_packets.html index 275b622c..2db5d4b8 100644 --- a/packet/templates/include/admin/open_packets.html +++ b/packet/templates/include/admin/open_packets.html @@ -21,7 +21,7 @@ height="25"/> {{ get_rit_name(packet.freshman_username) }} - + {% if packet.signatures_received_result.total == packet.signatures_required_result.total %} 💯 {# 100% emoji #} {% else %} From a669ecf4b38e4129c3f7cdd2f5cc74b25e4cefe9 Mon Sep 17 00:00:00 2001 From: Jeremy Smart Date: Thu, 5 Sep 2024 17:57:29 -0400 Subject: [PATCH 2/6] change packet sorting to percentage (#370) (#371) From 46676abdff2966b3c0c3b5928135e711942feabf Mon Sep 17 00:00:00 2001 From: Mobmaker <45888585+Mobmaker55@users.noreply.github.com> Date: Wed, 22 Jan 2025 21:13:03 -0500 Subject: [PATCH 3/6] Allow all frosh to vote (please test this) (#372) * Allow all frosh to vote (please test this) * fixed my stupidity --- packet/commands.py | 2 +- packet/routes/shared.py | 7 ------- packet/templates/active_packets.html | 7 +------ packet/templates/packet.html | 4 ++-- packet/utils.py | 12 ++---------- 5 files changed, 6 insertions(+), 26 deletions(-) diff --git a/packet/commands.py b/packet/commands.py index ea3591a9..31f95909 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 3508faa6..bd671bf8 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 bd8fdc3e..930d7366 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 f2bb98a3..c32658b2 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 a6e91581..278bb6c2 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() From 7b743e0eacdf2770d582c0e7ba81736c4945cda3 Mon Sep 17 00:00:00 2001 From: Sam Cordry Date: Sun, 26 Jan 2025 14:49:59 -0500 Subject: [PATCH 4/6] improve all frosh signing capabilities (#373) --- packet/templates/active_packets.html | 4 ++++ packet/templates/packet.html | 4 ++-- packet/utils.py | 8 ++++---- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/packet/templates/active_packets.html b/packet/templates/active_packets.html index 930d7366..3fa65640 100644 --- a/packet/templates/active_packets.html +++ b/packet/templates/active_packets.html @@ -40,13 +40,17 @@

Active Packets

{% for packet in packets %} + {% if info.is_upper %} + {% endif %} {{ get_rit_name(packet.freshman_username) }} {{ get_rit_name(packet.freshman_username) }} + {% if info.is_upper %} + {% endif %} {% if info.is_upper %} diff --git a/packet/templates/packet.html b/packet/templates/packet.html index c32658b2..a4de5039 100644 --- a/packet/templates/packet.html +++ b/packet/templates/packet.html @@ -10,7 +10,7 @@

{{ get_rit_name(packet.freshman_username) }}

- {% if not did_sign %} + {% if not did_sign and info.ritdn != packet.freshman_username %}