File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change 11from flask import render_template
2+ from datetime import datetime
3+ from itertools import chain
24
35from packet import auth , app
46from packet .models import Freshman , Packet
@@ -23,5 +25,18 @@ def freshman_packet(uid, info=None):
2325@auth .oidc_auth
2426@before_request
2527def packets (info = None ):
26- packets = Packet .query .all ()
28+ packets = Packet .query .filter (Packet .end > datetime .now ()).filter (Packet .start < datetime .now ()).all ()
29+
30+ # Add the did_sign flag
31+ if app .config ["REALM" ] == "csh" :
32+ # User is an upperclassman
33+ for packet in packets :
34+ for sig in chain (packet .upper_signatures , packet .misc_signatures ):
35+ packet .did_sign = sig .member == info ["uid" ]
36+ else :
37+ # User is a freshman
38+ for packet in packets :
39+ for sig in packet .fresh_signatures :
40+ packet .did_sign = sig .freshman_username == info ["uid" ]
41+
2742 return render_template ("active_packets.html" , info = info , packets = packets )
You can’t perform that action at this time.
0 commit comments