11from packet import app , db
2- from packet .utils import before_request , packet_auth
2+ from packet .utils import before_request , packet_auth , notify_slack
33from packet .models import Packet , MiscSignature
44
55
@@ -10,22 +10,29 @@ def sign(packet_id, info):
1010 packet = Packet .by_id (packet_id )
1111
1212 if packet is not None and packet .is_open ():
13+ was_100 = packet .is_100 ()
1314 if app .config ["REALM" ] == "csh" :
1415 # Check if the CSHer is an upperclassman and if so, sign that row
1516 for sig in filter (lambda sig : sig .member == info ["uid" ], packet .upper_signatures ):
1617 sig .signed = True
1718 db .session .commit ()
19+ if not was_100 and packet .is_100 ():
20+ notify_slack (packet .freshman .name )
1821 return "Success: Signed Packet: " + packet .freshman_username
1922
2023 # The CSHer is a misc so add a new row
2124 db .session .add (MiscSignature (packet = packet , member = info ["uid" ]))
2225 db .session .commit ()
26+ if not was_100 and packet .is_100 ():
27+ notify_slack (packet .freshman .name )
2328 return "Success: Signed Packet: " + packet .freshman_username
2429 else :
2530 # Check if the freshman is onfloor and if so, sign that row
2631 for sig in filter (lambda sig : sig .freshman_username == info ["uid" ], packet .fresh_signatures ):
2732 sig .signed = True
2833 db .session .commit ()
34+ if not was_100 and packet .is_100 ():
35+ notify_slack (packet .freshman .name )
2936 return "Success: Signed Packet: " + packet .freshman_username
3037
3138 return "Error: Signature not valid. Reason: Unknown"
0 commit comments