fix: fixes checks for non live games

This commit is contained in:
2024-02-19 03:49:02 -05:00
parent 18802f6ef5
commit 8611471360
5 changed files with 54 additions and 20 deletions

View File

@@ -6,8 +6,8 @@ SCOREBOARD_DATA_FILE = 'app/data/scoreboard_data.json'
def get_scoreboard_data():
now = datetime.now()
start_time_evening = now.replace(hour=23, minute=0, second=0, microsecond=0) # 7:00 PM EST
end_time_evening = now.replace(hour=8, minute=0, second=0, microsecond=0) # 3:00 AM EST
start_time_evening = now.replace(hour=23, minute=00, second=0, microsecond=0) # 7:00 PM EST
end_time_evening = now.replace(hour=8, minute=00, second=0, microsecond=0) # 3:00 AM EST
if now >= start_time_evening or now < end_time_evening:
# Use now URL

View File

@@ -10,16 +10,16 @@ def extract_game_info(scoreboard_data):
game_state = convert_game_state(game["gameState"])
extracted_info.append({
"Home Team": game["homeTeam"]["name"]["default"],
"Home Score": game["homeTeam"]["score"],
"Home Score": game["homeTeam"]["score"] if game_state != "PRE" else "N/A",
"Away Team": game["awayTeam"]["name"]["default"],
"Away Score": game["awayTeam"]["score"],
"Away Score": game["awayTeam"]["score"] if game_state != "PRE" else "N/A",
"Home Logo": game["homeTeam"]["logo"],
"Away Logo": game["awayTeam"]["logo"],
"Game State": game_state,
"Period": process_period(game),
"Time Remaining": process_time_remaining(game),
"Time Running": game["clock"]["running"],
"Intermission": game["clock"]["inIntermission"],
"Time Running": game["clock"]["running"] if game_state == "LIVE" else "N/A",
"Intermission": game["clock"]["inIntermission"] if game_state == "LIVE" else "N/A",
"Priority": calculate_game_priority(game),
"Start Time": process_start_time(game),
"Home Record": game["homeTeam"]["record"] if game["gameState"] in ["PRE", "FUT"] else "N/A",