def send_award_update(cls, event): users = PushHelper.get_users_subscribed_to_event( event, NotificationType.AWARDS) keys = PushHelper.get_client_ids_for_users(users) notification = AwardsUpdatedNotification(event) notification.send(keys)
def send_schedule_update(cls, event): users = PushHelper.get_users_subscribed_to_event( event, NotificationType.SCHEDULE_UPDATED) keys = PushHelper.get_client_ids_for_users(users) notification = ScheduleUpdatedNotification(event) notification.send(keys)
def send_match_video(cls, match): """ Sends match_video and event_match_video notifications If the match is current, MatchVideoNotification is sent. Otherwise, EventMatchVideoNotification is sent """ match_users = set(PushHelper.get_users_subscribed_to_match(match, NotificationType.MATCH_VIDEO)) event_users = set(PushHelper.get_users_subscribed_to_event(match.event.get(), NotificationType.MATCH_VIDEO)) users = match_users.union(event_users) if match.within_seconds(60*10): user_keys = PushHelper.get_client_ids_for_users(users) MatchVideoNotification(match).send(user_keys) else: user_keys = PushHelper.get_client_ids_for_users(users) EventMatchVideoNotification(match).send(user_keys)
def send_award_update(cls, event): users = PushHelper.get_users_subscribed_to_event(event, NotificationType.AWARDS) keys = PushHelper.get_client_ids_for_users(users) notification = AwardsUpdatedNotification(event) notification.send(keys)
def send_schedule_update(cls, event): users = PushHelper.get_users_subscribed_to_event(event, NotificationType.SCHEDULE_UPDATED) keys = PushHelper.get_client_ids_for_users(users) notification = ScheduleUpdatedNotification(event) notification.send(keys)