diff --git a/app/scoreboard/process_data.py b/app/scoreboard/process_data.py index e2f7682..a8c64c7 100644 --- a/app/scoreboard/process_data.py +++ b/app/scoreboard/process_data.py @@ -1,6 +1,14 @@ import sqlite3 from datetime import datetime, timedelta +def process_record(record): + if record == "N/A": + return "N/A" + else: + parts = record.split("-") + formatted_parts = [part.zfill(2) for part in parts] + return "-".join(formatted_parts) + def extract_game_info(scoreboard_data): if not scoreboard_data: return [] @@ -22,8 +30,8 @@ def extract_game_info(scoreboard_data): "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", - "Away Record": game["awayTeam"]["record"] if game["gameState"] in ["PRE", "FUT"] else "N/A", + "Home Record": process_record(game["homeTeam"]["record"]) if game["gameState"] in ["PRE", "FUT"] else "N/A", + "Away Record": process_record(game["awayTeam"]["record"]) if game["gameState"] in ["PRE", "FUT"] else "N/A", "Home Shots": game["homeTeam"]["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"]),