Пример #1
0
 def test_mark_log_deleted(self):
     gameinfo = DBSetup().create_teamlog_home_and_away()
     first_team = Team.objects.first()
     sequence = 2
     gamelog = GameLog(gameinfo)
     gamelog.mark_entries_as_deleted(sequence)
     gamelog_list = TeamLog.objects.filter(sequence=sequence)
     assert gamelog_list[
         0].isDeleted, 'touchdown should be marked as deleted'
     assert gamelog_list[1].isDeleted, 'PAT should be marked as deleted'
     actual_gamelog = TeamLog.objects.filter(gameinfo=gameinfo,
                                             team=first_team,
                                             half=1)
     actual_gamelog_entries_as_json = gamelog.create_entries_for_half(
         actual_gamelog)
     assert actual_gamelog_entries_as_json == [{
         'sequence': 1,
         'td': 19,
     }, {
         'sequence': 2,
         'td': 19,
         'pat2': 7,
         'isDeleted': True
     }, {
         'sequence': 3,
         'td': 19,
         'pat1': 7,
     }]
     assert gamelog.get_home_firsthalf_score() == 13
     assert gamelog.get_home_score() == 34
Пример #2
0
 def test_get_half_score(self):
     firstGameEntry = DBSetup().create_teamlog_home_and_away()
     gamelog = GameLog(firstGameEntry)
     assert gamelog.get_home_firsthalf_score() == 21
     assert gamelog.get_home_secondhalf_score() == 21
     assert gamelog.get_away_firsthalf_score() == 0
     assert gamelog.get_away_secondhalf_score() == 3
Пример #3
0
 def update_score(self, gamelog: GameLog):
     self.gameresult.save_home_first_half(gamelog.get_home_firsthalf_score(), gamelog.get_away_firsthalf_score())
     self.gameresult.save_away_first_half(gamelog.get_away_firsthalf_score(), gamelog.get_home_firsthalf_score())
     self.gameresult.save_home_second_half(gamelog.get_home_secondhalf_score(), gamelog.get_away_secondhalf_score())
     self.gameresult.save_away_second_half(gamelog.get_away_secondhalf_score(), gamelog.get_home_secondhalf_score())