Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added closed packets to admin page #367

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions packet/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']:
"""
Expand Down
8 changes: 4 additions & 4 deletions packet/routes/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand Down
2 changes: 1 addition & 1 deletion packet/templates/admin_packets.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
<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>
<th>Signatures</th>
</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) }}">
Expand Down