(self)
Function that handle the live game.

            Show the earliest game until the most prefered game start. 
            
            Always show the top team when the other games are final.
            
            If a higher game in priority starts, move to that one. 

            6:00 Final
            [7:00, *3:00, 7:00, 8:00, 10:00]

            9:45 (first game finished)
            [7:00, 7:00, 8:00, 10:00]
Function that handle the live game.
Function that handle the live game .
def check_game_priority(self):
        """
            Function that handle the live game.

            Show the earliest game until the most prefered game start. 
            
            Always show the top team when the other games are final.
            
            If a higher game in priority starts, move to that one. 

            6:00 Final
            [7:00, *3:00, 7:00, 8:00, 10:00]

            9:45 (first game finished)
            [7:00, 7:00, 8:00, 10:00]
        """

        self.current_game_id = self.pref_games[0].game_id
        earliest_start_time = datetime.strptime(self.pref_games[0].game_date, '%Y-%m-%dT%H:%M:%SZ')
        debug.info('checking highest priority game')
        for g in self.pref_games:
            if not self.status.is_final(g.status):
                # If the game started.
                if datetime.strptime(g.game_date, '%Y-%m-%dT%H:%M:%SZ') <= datetime.utcnow():
                    debug.info('Showing highest priority live game. {} vs {}'.format(g.away_team_name, g.home_team_name))
                    self.current_game_id = g.game_id
                    return
                # If the game has not started but is ealier then the previous set game
                if datetime.strptime(g.game_date, '%Y-%m-%dT%H:%M:%SZ') < earliest_start_time:
                    earliest_start_time = datetime.strptime(g.game_date, '%Y-%m-%dT%H:%M:%SZ')
                    self.current_game_id = g.game_id
                    debug.info('Showing earliest game. {} vs {}'.format(g.away_team_name, g.home_team_name))
                    earliest = True
def check_game_priority ( self ) : self . current_game_id = self . pref_games [ 0 ] . game_id earliest_start_time = datetime . strptime ( self . pref_games [ 0 ] . game_date , '%Y-%m-%dT%H:%M:%SZ' ) debug . info ( 'checking highest priority game' ) for g in self . pref_games : if not self . status . is_final ( g . status ) : # If the game started. if datetime . strptime ( g . game_date , '%Y-%m-%dT%H:%M:%SZ' ) <= datetime . utcnow ( ) : debug . info ( 'Showing highest priority live game. {} vs {}' . format ( g . away_team_name , g . home_team_name ) ) self . current_game_id = g . game_id return # If the game has not started but is ealier then the previous set game if datetime . strptime ( g . game_date , '%Y-%m-%dT%H:%M:%SZ' ) < earliest_start_time : earliest_start_time = datetime . strptime ( g . game_date , '%Y-%m-%dT%H:%M:%SZ' ) self . current_game_id = g . game_id debug . info ( 'Showing earliest game. {} vs {}' . format ( g . away_team_name , g . home_team_name ) ) earliest = True