コード例 #1
0
    def test_user_without_bets(self):

        self.game.score_team1 = 1
        self.game.score_team2 = 0
        db.session.commit()

        update_scores_by_game(self.game)
コード例 #2
0
ファイル: tasks.py プロジェクト: tupy/bolao
    def test_user_without_bets(self):

        self.game.score_team1 = 1
        self.game.score_team2 = 0
        db.session.commit()

        update_scores_by_game(self.game)
コード例 #3
0
ファイル: tasks.py プロジェクト: tupy/bolao
    def test_team1_result(self):

        self.game.score_team1 = 1
        self.game.score_team2 = 0

        bet = BetGame(user=self.user, game=self.game, score_team1=2, score_team2=1)
        db.session.add(bet)
        db.session.commit()

        update_scores_by_game(self.game)
        self.assertEqual(9, bet.score)
コード例 #4
0
ファイル: tasks.py プロジェクト: tupy/bolao
    def test_exact_draw(self):

        self.game.score_team1 = 1
        self.game.score_team2 = 1

        bet = BetGame(user=self.user, game=self.game, score_team1=1, score_team2=1)
        db.session.add(bet)
        db.session.commit()

        update_scores_by_game(self.game)
        self.assertEqual(18, bet.score)
コード例 #5
0
ファイル: tasks.py プロジェクト: tupy/bolao
    def test_team2_result_with_score(self):

        self.game.score_team1 = 0
        self.game.score_team2 = 2

        bet1 = BetGame(user=self.user, game=self.game, score_team1=1, score_team2=2)
        bet2 = BetGame(user=self.user2, game=self.game, score_team1=0, score_team2=1)
        db.session.add(bet1)
        db.session.add(bet2)
        db.session.commit()

        update_scores_by_game(self.game)
        self.assertEqual(12, bet1.score)
        self.assertEqual(12, bet2.score)
コード例 #6
0
ファイル: tasks.py プロジェクト: tupy/bolao
    def test_only_score(self):

        self.game.score_team1 = 0
        self.game.score_team2 = 0

        bet1 = BetGame(user=self.user, game=self.game, score_team1=1, score_team2=0)
        bet2 = BetGame(user=self.user2, game=self.game, score_team1=0, score_team2=1)
        db.session.add(bet1)
        db.session.add(bet2)
        db.session.commit()

        update_scores_by_game(self.game)
        self.assertEqual(3, bet1.score)
        self.assertEqual(3, bet2.score)
コード例 #7
0
    def test_exact_draw(self):

        self.game.score_team1 = 1
        self.game.score_team2 = 1

        bet = BetGame(user=self.user,
                      game=self.game,
                      score_team1=1,
                      score_team2=1)
        db.session.add(bet)
        db.session.commit()

        update_scores_by_game(self.game)
        self.assertEqual(18, bet.score)
コード例 #8
0
    def test_team2_result(self):

        self.game.score_team1 = 0
        self.game.score_team2 = 1

        bet = BetGame(user=self.user,
                      game=self.game,
                      score_team1=1,
                      score_team2=2)
        db.session.add(bet)
        db.session.commit()

        update_scores_by_game(self.game)
        self.assertEqual(9, bet.score)
コード例 #9
0
    def test_team2_result_with_score(self):

        self.game.score_team1 = 0
        self.game.score_team2 = 2

        bet1 = BetGame(user=self.user,
                       game=self.game,
                       score_team1=1,
                       score_team2=2)
        bet2 = BetGame(user=self.user2,
                       game=self.game,
                       score_team1=0,
                       score_team2=1)
        db.session.add(bet1)
        db.session.add(bet2)
        db.session.commit()

        update_scores_by_game(self.game)
        self.assertEqual(12, bet1.score)
        self.assertEqual(12, bet2.score)
コード例 #10
0
    def test_only_score(self):

        self.game.score_team1 = 0
        self.game.score_team2 = 0

        bet1 = BetGame(user=self.user,
                       game=self.game,
                       score_team1=1,
                       score_team2=0)
        bet2 = BetGame(user=self.user2,
                       game=self.game,
                       score_team1=0,
                       score_team2=1)
        db.session.add(bet1)
        db.session.add(bet2)
        db.session.commit()

        update_scores_by_game(self.game)
        self.assertEqual(3, bet1.score)
        self.assertEqual(3, bet2.score)
コード例 #11
0
 def on_model_change(self, form, model, is_created):
     if not is_created and model.score_team1 is not None:
         update_scores_by_game(model)
         update_ranking()
         update_positions()
コード例 #12
0
ファイル: admin.py プロジェクト: tupy/bolao
 def on_model_change(self, form, model, is_created):
     if not is_created and model.score_team1 is not None:
         update_scores_by_game(model)
         update_ranking()
         update_positions()