diff --git a/packet/models.py b/packet/models.py index f22e467f..0028f049 100644 --- a/packet/models.py +++ b/packet/models.py @@ -122,6 +122,14 @@ def is_100(self) -> bool: """ return self.signatures_required().total == self.signatures_received().total + @classmethod + def get_all(cls) -> list['Packet']: + """ + Helper method for fetching all packets + """ + return cls.query.all() + + @classmethod def open_packets(cls) -> list['Packet']: """ diff --git a/packet/routes/admin.py b/packet/routes/admin.py index 96a877b1..1ee0553f 100644 --- a/packet/routes/admin.py +++ b/packet/routes/admin.py @@ -14,18 +14,18 @@ @before_request @log_time def admin_packets(info=None): - open_packets = Packet.open_packets() + all_packets = Packet.get_all() # Pre-calculate and store the return values of did_sign(), signatures_received(), and signatures_required() - for packet in open_packets: + for packet in all_packets: packet.did_sign_result = packet.did_sign(info['uid'], app.config['REALM'] == 'csh') packet.signatures_received_result = packet.signatures_received() packet.signatures_required_result = packet.signatures_required() - open_packets.sort(key=packet_sort_key, reverse=True) + all_packets.sort(key=packet_sort_key, reverse=True) return render_template('admin_packets.html', - open_packets=open_packets, + open_packets=all_packets, info=info) diff --git a/packet/templates/admin_packets.html b/packet/templates/admin_packets.html index 9db36fd2..b2b7608f 100644 --- a/packet/templates/admin_packets.html +++ b/packet/templates/admin_packets.html @@ -19,7 +19,7 @@ <h4 class="page-title">Active Packets</h4> </div> </div> <div id="eval-blocks"> - {% include 'include/admin/open_packets.html' %} + {% include 'include/admin/all_packets.html' %} </div> </div> {% endblock %} diff --git a/packet/templates/include/admin/open_packets.html b/packet/templates/include/admin/all_packets.html similarity index 92% rename from packet/templates/include/admin/open_packets.html rename to packet/templates/include/admin/all_packets.html index 275b622c..afc964b2 100644 --- a/packet/templates/include/admin/open_packets.html +++ b/packet/templates/include/admin/all_packets.html @@ -2,7 +2,7 @@ <div class="card"> <div class="card-body table-fill"> <div class="table-responsive"> - <table id="open_packets_table" class="table table-striped no-bottom-margin"> + <table id="all_packets_table" class="table table-striped no-bottom-margin"> <thead> <tr> <th>Name</th> @@ -10,7 +10,7 @@ </tr> </thead> <tbody> - {% for packet in open_packets %} + {% for packet in all_packets %} <tr> <td data-priority="1"> <a href="{{ url_for('freshman_packet', packet_id=packet.id) }}">