Skip to content

Commit 7d3effe

Browse files
committed
Fixing searching and sorting for freshmen
1 parent b359f26 commit 7d3effe

File tree

3 files changed

+60
-53
lines changed

3 files changed

+60
-53
lines changed

packet/static/js/tables.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ $(document).ready(function () {
22

33
$('#active_packets_table').DataTable({
44
"searching": true,
5-
"order": [[2, 'desc']],
5+
"order": [],
66
"paging": false,
77
"info": false,
88
"columnDefs": [

packet/templates/active_packets.html

Lines changed: 52 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{% extends "extend/base.html" %}
22

3+
{% set can_sign = (info.onfloor and info.uid != packet.freshman.rit_username) or info.realm == "csh" %}
4+
35
{% block body %}
46
<div class="container main">
57
<div class="row mobile-hide">
@@ -12,57 +14,60 @@ <h3 class="page-title">Active Packets</h3>
1214
<div id="eval-table">
1315
<div class="card">
1416
<div class="card-body table-fill">
15-
<div class="card-body table-fill">
16-
<div class="table-responsive">
17-
<table id="active_packets_table" class="table table-striped no-bottom-margin">
18-
<thead>
19-
<tr>
20-
<th>Name</th>
21-
<th>Signatures</th>
17+
<div class="table-responsive">
18+
<table id="active_packets_table" class="table table-striped no-bottom-margin">
19+
<thead>
20+
<tr>
21+
<th>Name</th>
22+
<th>Signatures</th>
23+
{% if can_sign %}
2224
<th>Sign</th>
23-
</tr>
24-
</thead>
25-
<tbody>
26-
{% for packet in packets %}
27-
{% if packet.is_open() %}
28-
<tr {% if packet.did_sign %}style="background-color: #4caf505e" {% endif %}>
29-
<td>
30-
<a href="/packet/{{ packet.freshman.rit_username }}">
31-
<img class="eval-user-img"
32-
alt="{{ packet.freshman.name }}"
33-
src="https://www.gravatar.com/avatar/freshmen?d=mp&f=y"
34-
width="25"
35-
height="25"/> {{ packet.freshman.name }} ({{ packet.freshman.rit_username }})
36-
</a>
37-
</td>
38-
<td data-sort="{{ packet.total_signatures }}">
39-
{% if packet.total_signatures == packet.required_signatures %}
40-
💯 {# 100% emoji #}
25+
{% endif %}
26+
</tr>
27+
</thead>
28+
<tbody>
29+
{% for packet in packets %}
30+
{% if packet.is_open() %}
31+
<tr {% if packet.did_sign %}style="background-color: #4caf505e" {% endif %}>
32+
<td>
33+
<a href="/packet/{{ packet.freshman.rit_username }}">
34+
<img class="eval-user-img"
35+
alt="{{ packet.freshman.name }}"
36+
src="https://www.gravatar.com/avatar/freshmen?d=mp&f=y"
37+
width="25"
38+
height="25"/> {{ packet.freshman.name }}
39+
({{ packet.freshman.rit_username }})
40+
</a>
41+
</td>
42+
<td data-sort="{{ packet.total_signatures }}">
43+
{% if packet.total_signatures == packet.required_signatures %}
44+
💯 {# 100% emoji #}
45+
{% else %}
46+
{{ packet.total_signatures }}/
47+
{{ packet.required_signatures }}
48+
{% endif %}
49+
</td>
50+
{% if can_sign %}
51+
<td class="sign-packet" align="right">
52+
{% if not packet.did_sign %}
53+
<button class="btn btn-sm btn-primary sign-button"
54+
data-freshman_uid="{{ packet.freshman.rit_username }}"
55+
data-freshman_name="{{ packet.freshman.name }}">
56+
Sign
57+
</button>
4158
{% else %}
42-
{{ packet.total_signatures }}/{{ packet.required_signatures }}
59+
<button class="btn btn-sm btn-primary signed-button"
60+
disabled="disabled"><i
61+
class="fa fa-check"></i>&nbsp;Signed
62+
</button>
4363
{% endif %}
4464
</td>
45-
{% if (info.onfloor and info.uid != packet.freshman.rit_username) or info.realm == "csh" %}
46-
<td class="sign-packet" align="right">
47-
{% if not packet.did_sign %}
48-
<button class="btn btn-sm btn-primary sign-button"
49-
data-freshman_uid="{{ packet.freshman.rit_username }}"
50-
data-freshman_name="{{ packet.freshman.name }}">
51-
Sign
52-
</button>
53-
{% else %}
54-
<button class="btn btn-sm btn-primary signed-button" disabled="disabled"><i
55-
class="fa fa-check"></i>&nbsp;Signed
56-
</button>
57-
{% endif %}
58-
</td>
59-
{% endif %}
60-
</tr>
61-
{% endif %}
62-
{% endfor %}
63-
</tbody>
64-
</table>
65-
</div>
65+
{% endif %}
66+
</tr>
67+
{% endif %}
68+
{% endfor %}
69+
</tbody>
70+
</table>
6671
</div>
6772
</div>
6873
</div>

packet/templates/packet.html

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{% extends "extend/base.html" %}
22

3+
{% set packet_end = freshman.current_packet().end.strftime('%m/%d/%Y') %}
4+
35
{% block body %}
46
<div class="container main">
57
<div class="mb-2">
@@ -26,26 +28,26 @@ <h3>{{ freshman.name }}</h3>
2628
<div class="col">
2729
<h5>Signatures: {{ signed }}/{{ required }}</h5>
2830
</div>
31+
<div class="col">
32+
<h5 class="right-align">Packet Ends: {{ packet_end }}</h5>
33+
</div>
2934
</div>
3035
<div class="card card-body">
3136
<div class="row justify-content-between">
3237
<div class="col">
33-
<b class="signature-count">{{ '%0.2f' % (signed/required * 100) }}%</b>
34-
<h5>Total Score</h5>
38+
<h5>Total Score - {{ '%0.2f' % (signed/required * 100) }}%</h5>
3539
<div class="progress">
3640
<div class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar"
3741
aria-valuenow="{{ signed/required * 100 }}" aria-valuemin="0" aria-valuemax="100"
3842
style="width: {{ signed/required * 100 }}%"></div>
3943
</div>
40-
<b class="signature-count">{{ '%0.2f' % upperclassmen_percent }}%</b>
41-
<h5>Upperclassmen Score</h5>
44+
<h5>Upperclassmen Score - {{ '%0.2f' % upperclassmen_percent }}%</h5>
4245
<div class="progress">
4346
<div class="progress-bar bg-warning progress-bar-striped progress-bar-animated"
4447
role="progressbar"
4548
aria-valuenow="{{ upperclassmen_percent }}" aria-valuemin="0" aria-valuemax="100"
4649
style="width: {{ upperclassmen_percent }}%"></div>
4750
</div>
48-
4951
</div>
5052
</div>
5153
</div>

0 commit comments

Comments
 (0)