Exemple #1
0
    def put(cls, tournament_id, group2):

        tournament = ScoreModel.get_points(tournament_id, group2)

        tournament = ScoreModel.add_pb2(tournament)

        if tournament:
            for row in tournament:
                row.save_to_db()

        return {"scores": [row.json() for row in ScoreModel.find_all(tournament_id)]}
Exemple #2
0
    def put(cls, tournament_id):

        tournament = ScoreModel.get_all_members(tournament_id)
        number = len(tournament)

        tournament = ScoreModel.get_number_of_tables(number, tournament)

        if tournament:
            for row in tournament:
                row.save_to_db()

        return {"scores": [row.json() for row in ScoreModel.find_all(tournament_id)]}
Exemple #3
0
    def put(cls, tournament_id, user_id):

        tournament = ScoreModel.get_all_members(tournament_id)
        user = ScoreModel.get_user(user_id)

        tournament = ScoreModel.add_second_tie_breaker(tournament, user, user_id)

        if tournament:
            for row in tournament:
                row.save_to_db()

        return {"scores": [row.json() for row in ScoreModel.find_all(tournament_id)]}
Exemple #4
0
    def get(cls, tournament_id):
        scores = [score.json() for score in ScoreModel.find_all(tournament_id)]
        if scores:
            return {"scores": scores}, 200
        return {"message": ITEM_NOT_FOUND}, 404


#    def get(self):
#        scores = [score.json() for score in ScoreModel.find_all()]
#        return {'scores': scores}, 200
#    @jwt_optional
#    def get(self):
#        user_id = get_jwt_identity()
#        scores = [score.json() for score in ScoreModel.find_all()]
#        if user_id:
#            return {'scores': scores}, 200
#        return (
#            {
#                'scores': [score[''] for score in scores],
#                'message': 'Więcej informacji po zalogowaniu.'
#            }
#        )
Exemple #5
0
    def put(cls, tournament_id):

        check_owners = ScoreModel.get_all_members(tournament_id)
        groups2 = []

        if check_owners:
            for row in check_owners:
                if row.has_own_game:
                    row.group2 = row.group1
                    groups2.append(row.group2)
                    row.save_to_db()

        tournament = ScoreModel.get_group2(tournament_id)

        number = len(tournament)

        tournament = ScoreModel.get_number_of_tables2(number, tournament, groups2)

        if tournament:
            for row in tournament:
                row.save_to_db()

        return {"scores": [row.json() for row in ScoreModel.find_all(tournament_id)]}