fix: last period type
This commit is contained in:
@@ -7,6 +7,7 @@ def extract_game_info(scoreboard_data):
|
|||||||
|
|
||||||
extracted_info = []
|
extracted_info = []
|
||||||
for game in scoreboard_data.get("games", []):
|
for game in scoreboard_data.get("games", []):
|
||||||
|
game_state = convert_game_state(game["gameState"])
|
||||||
extracted_info.append({
|
extracted_info.append({
|
||||||
"Home Team": game["homeTeam"]["name"]["default"],
|
"Home Team": game["homeTeam"]["name"]["default"],
|
||||||
"Home Score": game["homeTeam"]["score"],
|
"Home Score": game["homeTeam"]["score"],
|
||||||
@@ -14,7 +15,7 @@ def extract_game_info(scoreboard_data):
|
|||||||
"Away Score": game["awayTeam"]["score"],
|
"Away Score": game["awayTeam"]["score"],
|
||||||
"Home Logo": game["homeTeam"]["logo"],
|
"Home Logo": game["homeTeam"]["logo"],
|
||||||
"Away Logo": game["awayTeam"]["logo"],
|
"Away Logo": game["awayTeam"]["logo"],
|
||||||
"Game State": convert_game_state(game["gameState"]),
|
"Game State": game_state,
|
||||||
"Period": process_period(game),
|
"Period": process_period(game),
|
||||||
"Time Remaining": process_time_remaining(game),
|
"Time Remaining": process_time_remaining(game),
|
||||||
"Time Running": game["clock"]["running"],
|
"Time Running": game["clock"]["running"],
|
||||||
@@ -27,7 +28,7 @@ def extract_game_info(scoreboard_data):
|
|||||||
"Away Shots": game["awayTeam"]["sog"] if game["gameState"] not in ["PRE", "FUT"] else 0,
|
"Away Shots": game["awayTeam"]["sog"] if game["gameState"] not in ["PRE", "FUT"] else 0,
|
||||||
"Home Power Play": get_power_play_info(game, game["homeTeam"]["name"]["default"]),
|
"Home Power Play": get_power_play_info(game, game["homeTeam"]["name"]["default"]),
|
||||||
"Away Power Play": get_power_play_info(game, game["awayTeam"]["name"]["default"]),
|
"Away Power Play": get_power_play_info(game, game["awayTeam"]["name"]["default"]),
|
||||||
"Last Period Type": get_game_outcome(game)
|
"Last Period Type": get_game_outcome(game, game_state)
|
||||||
})
|
})
|
||||||
|
|
||||||
# Sort games based on priority
|
# Sort games based on priority
|
||||||
@@ -70,8 +71,8 @@ def get_power_play_info(game, team_name):
|
|||||||
return f"PP {game['situation']['timeRemaining']}"
|
return f"PP {game['situation']['timeRemaining']}"
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
def get_game_outcome(game):
|
def get_game_outcome(game, game_state):
|
||||||
return game["gameOutcome"]["lastPeriodType"] if game["gameState"] == "FINAL" else "N/A"
|
return game["gameOutcome"]["lastPeriodType"] if game_state == "FINAL" else "N/A"
|
||||||
|
|
||||||
def calculate_game_priority(game):
|
def calculate_game_priority(game):
|
||||||
# Return 0 if game is in certain states
|
# Return 0 if game is in certain states
|
||||||
|
|||||||
Reference in New Issue
Block a user