Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create method to check of if tournament exists #34

Open
github-actions bot opened this issue Sep 26, 2021 · 0 comments
Open

Create method to check of if tournament exists #34

github-actions bot opened this issue Sep 26, 2021 · 0 comments
Labels
duplicate This issue or pull request already exists quick Can be closed out quickly state todo

Comments

@github-actions
Copy link

Create method to check of if tournament exists

This is code duplication, create a method for this

# TODO Create method to check of if tournament exists

        # labels: state
        # Do a check if the category and channel have already been created.
        await self.start_signup_command(ctx, self.tournaments[id]['channel_name'], f'General - {id}', reaction, OUTPUTS['SIGNUP'])
        return TournamentStatus.SIGNUPS_STARTED

    def start_tournament(self, id: str) -> TournamentStatus:
        """Sets tournament stats to True and sets the signed up players to the active list"""
        # TODO Create method to check of if tournament exists
        # labels: quick, state, duplicate
        # This is code duplication, create a method for this
        if (tournament := self.tournaments.get(id)) == None:
            return TournamentStatus.TOURNAMENT_NOT_FOUND

        if tournament['status'] == False:
            response = self.client.send_data('/start_tournament', { 'id': tournament['id'], 'tournament': tournament }, 'start_tournament')
            
            if response.status_code != 200:
                return TournamentStatus.ERROR_STATUS_CODE

            tournament['status'] = True
            tournament['players_attended'] = tournament['players_signed_up']
 
        return TournamentStatus.TOURNAMENT_STARTED

    def player_signed_up(self, id, player):
        """Stores the player who just signed up in state and sends data to API"""
        response = self.client.send_data('/player_signed_up', { 'id': id, 'player': player }, 'player_signed_up')
        print(response.status_code)
        if response.status_code != 200:
            return TournamentStatus.ERROR_STATUS_CODE

        self.tournaments[id]['players_signed_up'].append(player)
        print('Client -> ', self.tournaments)
        return TournamentStatus.PLAYER_SIGNED_UP

    def player_removed_from_signups(self, id, player):
        """Removes player from signups"""

b663533b9eeadd24b23484156fe124caf289ef3e

@github-actions github-actions bot added duplicate This issue or pull request already exists quick Can be closed out quickly state todo labels Sep 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists quick Can be closed out quickly state todo
Projects
None yet
Development

No branches or pull requests

0 participants