11import requests
22from datetime import datetime , timedelta
33from zoneinfo import ZoneInfo
4+ from .teams import TEAM_MAP
45
56class VLRService :
67 MATCHES_URL = "https://vlr.orlandomm.net/api/v1/matches"
@@ -26,7 +27,7 @@ def get_vct_dashboard_data(cls):
2627 return {
2728 ** results , # Contains y_res and t_res
2829 ** matches , # Contains live, t_up, and tom_up
29- "last_updated" : now .strftime ("%H:%M" )
30+ "last_updated" : now .strftime ("%H:%M" ). lower ()
3031 }
3132
3233 # --- Private Logic: Processing ---
@@ -99,15 +100,24 @@ def _normalize_item(data):
99100 time_str = ""
100101
101102 if ts :
103+ # Apply 6-hour correction and convert to London Time
102104 corrected_ts = ts + (VLRService .TIME_OFFSET_HOURS * 3600 )
103- dt_utc = datetime .fromtimestamp (corrected_ts , tz = ZoneInfo ("UTC" ))
104- dt_london = dt_utc .astimezone (VLRService .LONDON_TZ )
105- time_str = dt_london .strftime ("%H:%M" )
105+ dt_london = datetime .fromtimestamp (corrected_ts , tz = ZoneInfo ("UTC" )).astimezone (VLRService .LONDON_TZ )
106+
107+ # FORMAT: 12-hour time
108+ time_str = dt_london .strftime ("%I:%M%p" ).lower ().lstrip ('0' )
109+
110+ t1_full = data ['teams' ][0 ]['name' ]
111+ t2_full = data ['teams' ][1 ]['name' ]
112+
113+ # Check if abbreviation exists, otherwise use full name
114+ t1_display = TEAM_MAP .get (t1_full , t1_full )
115+ t2_display = TEAM_MAP .get (t2_full , t2_full )
106116
107117 return {
108- "t1" : data [ 'teams' ][ 0 ][ 'name' ] ,
118+ "t1" : t1_display ,
109119 "s1" : data ['teams' ][0 ].get ('score' ),
110- "t2" : data [ 'teams' ][ 1 ][ 'name' ] ,
120+ "t2" : t2_display ,
111121 "s2" : data ['teams' ][1 ].get ('score' ),
112122 "tournament" : data .get ('tournament' ),
113123 "event" : data .get ('event' ),
0 commit comments