Exemplo n.º 1
0
    def check_group_integrity(self):
        '''

        2015-4-17: can't check this from set_players,
        because sometimes we are intentionally in an inconsistent state
        e.g., if group_by_arrival_time is true, and some players have not
        been assigned to groups yet
        '''
        players = get_players(self, order_by='id', refresh_from_db=True)
        groups = [get_players(g, 'id', True) for g in get_groups(self, True)]
        players_from_groups = flatten(groups)

        assert set(players) == set(players_from_groups)
Exemplo n.º 2
0
    def check_group_integrity(self):
        '''

        2015-4-17: can't check this from set_players,
        because sometimes we are intentionally in an inconsistent state
        e.g., if group_by_arrival_time is true, and some players have not
        been assigned to groups yet
        '''
        players = get_players(self, order_by='id', refresh_from_db=True)
        groups = [get_players(g, 'id', True) for g in get_groups(self, True)]
        players_from_groups = flatten(groups)

        assert set(players) == set(players_from_groups)
Exemplo n.º 3
0
    def _create_groups(self):
        if self.round_number == 1:
            group_matrix = self._first_round_group_matrix()
        else:
            previous_round = self._in_previous_round()
            group_matrix = [
                group._get_players(refresh_from_db=True)
                for group in get_groups(previous_round, refresh_from_db=True)
            ]
            for i, group_list in enumerate(group_matrix):
                for j, player in enumerate(group_list):

                    # for every entry (i,j) in the matrix, follow the pointer
                    # to the same person in the next round
                    group_matrix[i][j] = player._in_next_round()

        # save to DB
        self.set_groups(group_matrix)
Exemplo n.º 4
0
    def _create_groups(self):
        if self.round_number == 1:
            group_matrix = self._first_round_group_matrix()
        else:
            previous_round = self._in_previous_round()
            group_matrix = [
                group._get_players(refresh_from_db=True)
                for group in get_groups(previous_round, refresh_from_db=True)
            ]
            for i, group_list in enumerate(group_matrix):
                for j, player in enumerate(group_list):

                    # for every entry (i,j) in the matrix, follow the pointer
                    # to the same person in the next round
                    group_matrix[i][j] = player._in_next_round()

        # save to DB
        self.set_groups(group_matrix)
Exemplo n.º 5
0
 def get_groups(self):
     return get_groups(self, refresh_from_db=False)
Exemplo n.º 6
0
 def get_groups(self):
     return get_groups(self, refresh_from_db=False)