Skip to content

Commit e573249

Browse files
authored
Merge pull request #89 from ComputerScienceHouse/develop
Version 3.0.5
2 parents 8755eb5 + 0d25de5 commit e573249

File tree

3 files changed

+26
-26
lines changed

3 files changed

+26
-26
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"title": "CSH Packet",
33
"name": "csh-packet",
4-
"version": "3.0.4",
4+
"version": "3.0.5",
55
"description": "A webpacket for CSH",
66
"bugs": {
77
"url": "https://github.com/ComputerScienceHouse/packet/issues",

packet/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "3.0.4"
1+
__version__ = "3.0.5"

packet/member.py

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,22 @@ def current_packets(member, intro=False, onfloor=False):
2222
SPacket = namedtuple('spacket', ['rit_username', 'name', 'did_sign', 'total_signatures', 'required_signatures'])
2323

2424
packets = []
25-
required = get_number_required()
26-
27-
if intro and onfloor:
28-
required -= 1
25+
base_required = get_number_required()
2926

3027
signed_packets = get_signed_packets(member, intro, onfloor)
3128
misc_signatures = get_misc_signatures()
3229

3330
try:
3431
for pkt in query_packets_with_signed():
35-
signed = signed_packets.get(pkt.username)
36-
misc = misc_signatures.get(pkt.username)
37-
if signed is None:
38-
signed = False
39-
if misc is None:
40-
misc = 0
32+
signed = signed_packets.get(pkt.username) or False
33+
misc = misc_signatures.get(pkt.username) or 0
4134
if misc > REQUIRED_MISC_SIGNATURES:
4235
misc = REQUIRED_MISC_SIGNATURES
36+
37+
required = base_required
38+
if pkt.onfloor:
39+
required -= 1
40+
4341
packets.append(SPacket(pkt.username, pkt.name, signed, pkt.received + misc, required))
4442

4543
except exc.SQLAlchemyError as e:
@@ -87,20 +85,22 @@ def query_packets_with_signed():
8785
"""
8886
try:
8987
return db.engine.execute("""
90-
SELECT packets.username AS username, packets.name AS name, coalesce(packets.sigs_recvd, 0) AS received
91-
FROM ( ( SELECT freshman.rit_username
92-
AS username, freshman.name AS name, packet.id AS id, packet.start AS start, packet.end AS end
93-
FROM freshman INNER JOIN packet ON freshman.rit_username = packet.freshman_username) AS a
94-
LEFT JOIN ( SELECT totals.id AS id, coalesce(sum(totals.signed), 0) AS sigs_recvd
95-
FROM ( SELECT packet.id AS id, coalesce(count(signature_fresh.signed), 0) AS signed
96-
FROM packet FULL OUTER JOIN signature_fresh ON signature_fresh.packet_id = packet.id
97-
WHERE signature_fresh.signed = TRUE AND packet.start < now() AND now() < packet.end
98-
GROUP BY packet.id
99-
UNION SELECT packet.id AS id, coalesce(count(signature_upper.signed), 0) AS signed FROM packet
100-
FULL OUTER JOIN signature_upper ON signature_upper.packet_id = packet.id
101-
WHERE signature_upper.signed = TRUE AND packet.start < now() AND now() < packet.end
102-
GROUP BY packet.id ) totals GROUP BY totals.id ) AS b ON a.id = b.id ) AS packets
103-
WHERE packets.start < now() AND now() < packets.end;
88+
SELECT packets.username AS username, packets.name AS name, packets.onfloor AS onfloor,
89+
coalesce(packets.sigs_recvd, 0) AS received
90+
FROM ( ( SELECT freshman.rit_username
91+
AS username, freshman.name AS name, freshman.onfloor
92+
AS onfloor, packet.id AS id, packet.start AS start, packet.end AS end
93+
FROM freshman INNER JOIN packet ON freshman.rit_username = packet.freshman_username) AS a
94+
LEFT JOIN ( SELECT totals.id AS id, coalesce(sum(totals.signed), 0) AS sigs_recvd
95+
FROM ( SELECT packet.id AS id, coalesce(count(signature_fresh.signed), 0) AS signed
96+
FROM packet FULL OUTER JOIN signature_fresh ON signature_fresh.packet_id = packet.id
97+
WHERE signature_fresh.signed = TRUE AND packet.start < now() AND now() < packet.end
98+
GROUP BY packet.id
99+
UNION SELECT packet.id AS id, coalesce(count(signature_upper.signed), 0) AS signed FROM packet
100+
FULL OUTER JOIN signature_upper ON signature_upper.packet_id = packet.id
101+
WHERE signature_upper.signed = TRUE AND packet.start < now() AND now() < packet.end
102+
GROUP BY packet.id ) totals GROUP BY totals.id ) AS b ON a.id = b.id ) AS packets
103+
WHERE packets.start < now() AND now() < packets.end;
104104
""")
105105

106106
except exc.SQLAlchemyError:

0 commit comments

Comments
 (0)