def _trigger_played_match(self, match_type): if MatchSoloQueue.query(MatchSoloQueue.type == match_type).count() >= 2: match_solo_queues = [match_queue for match_queue in MatchSoloQueue.query(MatchSoloQueue.type == match_type).fetch(10)] players = [match_queue.player.get() for match_queue in match_solo_queues] match = Match(type=match_type) match.setup_soloqueue_match(players) ndb.delete_multi([queue.key for queue in match_solo_queues]) for player in players: player.doing = match.key player.put() websocket_notify_player("Player_MatchFound", player.key, None, match.get_data())
def _notify_players_new_queue_size(self, match_queue_type): all_match_queues = MatchSoloQueue.query(MatchSoloQueue.type == match_queue_type) all_match_queues_count = all_match_queues.count() for match_queue in all_match_queues: websocket_notify_player("Match_NewQueueCount", match_queue.player, "player.doing", {'queued': all_match_queues_count})