File tree Expand file tree Collapse file tree 8 files changed +61
-5
lines changed Expand file tree Collapse file tree 8 files changed +61
-5
lines changed Original file line number Diff line number Diff line change 1+ python 3.9.7
2+ nodejs 10.24.1
Original file line number Diff line number Diff line change @@ -129,6 +129,13 @@ def open_packets(cls) -> list['Packet']:
129129 """
130130 return cls .query .filter (cls .start < datetime .now (), cls .end > datetime .now ()).all ()
131131
132+ @classmethod
133+ def opened_after (cls , date : DateTime ) -> list ['Packet' ]:
134+ """
135+ Helper method for fetching all packets opened after a given date
136+ """
137+ return cls .query .filter (cls .start > date ).all ()
138+
132139 @classmethod
133140 def by_id (cls , packet_id : int ) -> 'Packet' :
134141 """
Original file line number Diff line number Diff line change 11from flask import render_template
2+ import datetime
23
34from packet import app
45from packet .models import Packet , Freshman
@@ -29,6 +30,28 @@ def admin_packets(info=None):
2930 info = info )
3031
3132
33+ @app .route ('/admin/past-packets' )
34+ @log_cache
35+ @packet_auth
36+ @admin_auth
37+ @before_request
38+ @log_time
39+ def admin_past_packets (info = None ):
40+ open_packets = Packet .opened_after (datetime .date .today () - datetime .timedelta (days = (30 * 4 )))
41+
42+ # Pre-calculate and store the return values of did_sign(), signatures_received(), and signatures_required()
43+ for packet in open_packets :
44+ packet .did_sign_result = packet .did_sign (info ['uid' ], app .config ['REALM' ] == 'csh' )
45+ packet .signatures_received_result = packet .signatures_received ()
46+ packet .signatures_required_result = packet .signatures_required ()
47+
48+ open_packets .sort (key = packet_sort_key , reverse = False )
49+
50+ return render_template ('admin_past_packets.html' ,
51+ open_packets = open_packets ,
52+ info = info )
53+
54+
3255@app .route ('/admin/freshmen' )
3356@log_cache
3457@packet_auth
Original file line number Diff line number Diff line change 1+ {% extends "extend/base.html" %}
2+
3+ {% block body %}
4+ < div class ="container main ">
5+ < div class ="ml-4 ">
6+ < div class ="row justify-content-between w-100 ">
7+ < div class ="col-xs-10 ">
8+ < h4 class ="page-title "> Past Packets</ h4 >
9+ </ div >
10+ </ div >
11+ </ div >
12+ < div id ="eval-blocks ">
13+ {% include 'include/admin/open_packets.html' %}
14+ </ div >
15+ </ div >
16+ {% endblock %}
17+
18+ {% block scripts %}
19+ {{ super() }}
20+ < script src ="{{ url_for('static', filename='js/admin.min.js') }} "> </ script >
21+ {% endblock %}
Original file line number Diff line number Diff line change 2626 </ a >
2727 < div class ="dropdown-menu " aria-labelledby ="navbarDropdownMenuLink ">
2828 < a class ="dropdown-item " href ="{{ url_for( "admin_freshmen ") }}"> Freshmen</ a >
29- < a class ="dropdown-item " href ="{{ url_for( "admin_packets ") }}"> Packets</ a >
29+ < a class ="dropdown-item " href ="{{ url_for( "admin_packets ") }}"> Active Packets</ a >
30+ < a class ="dropdown-item " href ="{{ url_for( "admin_past_packets ") }}"> Past Packets</ a >
3031 </ div >
3132 </ li >
3233 {% endif %}
Original file line number Diff line number Diff line change @@ -70,7 +70,7 @@ def before_reqest_callback() -> Any:
7070 """
7171 Pre-request function to ensure we're on the right URL before OIDC sees anything
7272 """
73- if urlparse (request .base_url ).hostname != app .config ['SERVER_NAME' ]:
73+ if urlparse (request .base_url ).hostname != app .config ['SERVER_NAME' ]. split ( ':' )[ 0 ] :
7474 return redirect (request .base_url .replace (urlparse (request .base_url ).hostname ,
7575 app .config ['SERVER_NAME' ]), code = 302 )
7676 return None
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ Flask-Mail==0.9.1
33Flask-Migrate~=2.7.0
44Flask-pyoidc~=3.7.0
55Flask~=1.1.4
6- csh_ldap~=2.3.1
6+ csh_ldap~=2.4.0
77ddtrace==1.1.4
88flask_sqlalchemy~=2.5.1
99gunicorn~=20.0.4
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ click==7.1.2
2828 # pip-tools
2929cryptography == 37.0.2
3030 # via oic
31- csh-ldap == 2.3.1
31+ csh-ldap == 2.4.0
3232 # via -r requirements.in
3333ddsketch == 2.0.3
3434 # via ddtrace
@@ -60,6 +60,8 @@ flask-sqlalchemy==2.5.1
6060 # flask-migrate
6161future == 0.18.2
6262 # via pyjwkest
63+ greenlet == 1.1.3
64+ # via sqlalchemy
6365gunicorn == 20.0.4
6466 # via -r requirements.in
6567idna == 3.3
@@ -129,7 +131,7 @@ pylint-quotes==0.2.1
129131 # via -r requirements.in
130132pyparsing == 3.0.9
131133 # via packaging
132- python-ldap == 3.0 .0
134+ python-ldap == 3.4 .0
133135 # via csh-ldap
134136requests == 2.27.1
135137 # via
You can’t perform that action at this time.
0 commit comments