@@ -39,7 +39,6 @@ def packet_signed_notification(packet, signer):
3939def packet_100_percent_notification (packet ):
4040 member_subscriptions = NotificationSubscription .query .filter (NotificationSubscription .member .isnot (None ))
4141 intro_subscriptions = NotificationSubscription .query .filter (NotificationSubscription .freshman_username .isnot (None ))
42-
4342 if member_subscriptions or intro_subscriptions :
4443 notification_body = post_body
4544 notification_body ["contents" ]["en" ] = packet .freshman .name + ' got 💯 on packet!'
@@ -49,3 +48,26 @@ def packet_100_percent_notification(packet):
4948
5049 send_notification (notification_body , member_subscriptions , csh_onesignal_client )
5150 send_notification (notification_body , intro_subscriptions , intro_onesignal_client )
51+
52+
53+ def packet_starting_notification (packet ):
54+ subscriptions = NotificationSubscription .query .filter_by (freshman_username = packet .freshman_username )
55+ if subscriptions :
56+ notification_body = post_body
57+ notification_body ["contents" ]["en" ] = 'Log into your packet, and get started meeting people!'
58+ notification_body ["headings" ]["en" ] = 'Your packet has begun!'
59+ notification_body ["url" ] = app .config ["PROTOCOL" ] + app .config ["PACKET_INTRO" ]
60+ notification_body ["send_after" ] = packet .start
61+
62+ send_notification (notification_body , subscriptions , intro_onesignal_client )
63+
64+
65+ def packets_starting_notification (start_date ):
66+ member_subscriptions = NotificationSubscription .query .filter (NotificationSubscription .member .isnot (None ))
67+ if member_subscriptions :
68+ notification_body = post_body
69+ notification_body ["contents" ]["en" ] = 'New packets have started, visit packet to see them!'
70+ notification_body ["headings" ]["en" ] = 'Packets Start Today!'
71+ notification_body ["send_after" ] = start_date .strftime ("%Y-%m-%d %H:%M:%S" )
72+
73+ send_notification (notification_body , member_subscriptions , csh_onesignal_client )
0 commit comments