def addToQueue(player: Member, mins_to_queue_for: int = 60) -> None: new_player = BallChaser(id=player.id, name=str(player), mmr=Leaderboard.getPlayerMMR(player), queueTime=(datetime.now() + timedelta(minutes=mins_to_queue_for))) currQueue.insert(Document(new_player.toJSON(), doc_id=new_player.id))
def reportConfirm(player: BallChaser, match: Document, whoWon: Team) -> bool: # If first responder or a winning team disagreement, we update the report if ( match[MatchKey.REPORTED_WINNER][MatchKey.WINNING_TEAM] is None or match[MatchKey.REPORTED_WINNER][MatchKey.WINNING_TEAM] != whoWon ): activeMatches.update({ MatchKey.REPORTED_WINNER: { MatchKey.WINNING_TEAM: whoWon, MatchKey.REPORTER: player.toJSON(short=True) } }, doc_ids=[match.doc_id]) return False # Make sure second reported is on the other team if (player.team == match[MatchKey.REPORTED_WINNER][MatchKey.REPORTER][MatchKey.TEAM]): return False return True