Skip to content

Commit 1848dd1

Browse files
authored
Merge pull request #83 from ComputerScienceHouse/eboard-offfloor-fix
Added support for seeing upper signatures only on active packet page
2 parents 2e400de + c1bc6b9 commit 1848dd1

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

packet/models.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,6 @@ def signatures_received(self, total=False):
6868
if misc_count > REQUIRED_MISC_SIGNATURES:
6969
misc_count = REQUIRED_MISC_SIGNATURES
7070

71-
if total:
72-
return db.session.query(Packet.freshman_username) \
73-
.select_from(Packet).outerjoin(UpperSignature).outerjoin(FreshSignature) \
74-
.filter(or_(and_(Packet.freshman_username == self.freshman_username, UpperSignature.signed),
75-
and_(Packet.freshman_username == self.freshman_username, FreshSignature.signed))) \
76-
.distinct().count() + misc_count
77-
7871
eboard_count = db.session.query(UpperSignature.member) \
7972
.select_from(Packet).join(UpperSignature) \
8073
.filter(Packet.freshman_username == self.freshman_username,
@@ -94,6 +87,9 @@ def signatures_received(self, total=False):
9487
FreshSignature.signed) \
9588
.distinct().count()
9689

90+
if total:
91+
return eboard_count + upper_count + fresh_count + misc_count
92+
9793
return {'eboard': eboard_count,
9894
'upperclassmen': upper_count,
9995
'freshmen': fresh_count,

packet/routes/shared.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from flask import render_template, redirect
22

3-
from packet import auth, app
3+
from packet import auth, app, ldap
4+
from packet.ldap import ldap_is_eboard
45
from packet.member import current_packets
56
from packet.packet import get_number_required, get_number_signed, signed_packet, get_freshman
67
from packet.packet import get_signatures, get_upperclassmen_percent
@@ -36,7 +37,7 @@ def freshman_packet(uid, info=None):
3637
def packets(info=None):
3738
if app.config["REALM"] == "csh":
3839
if info["member_info"]["onfloor"]:
39-
if info["member_info"]["room"] is not None:
40+
if info["member_info"]["room"] is not None or ldap_is_eboard(info['uid']):
4041
open_packets = current_packets(info["uid"], False, True)
4142
else:
4243
open_packets = current_packets(info["uid"], False, False)

0 commit comments

Comments
 (0)