2.0.0 Alpha: Data Refinery

This commit is contained in:
2026-08-08 21:31:56 +08:00
parent fa75081d4d
commit 562775e5db
48 changed files with 4172 additions and 661 deletions
+36
View File
@@ -0,0 +1,36 @@
import json
from web.services.web_service import WebService
class TeamContextService:
"""Single source of truth for the private team's active roster."""
@staticmethod
def get_active_lineup():
lineup = WebService.get_active_lineup()
return dict(lineup) if lineup else None
@staticmethod
def get_active_roster_ids():
lineup = TeamContextService.get_active_lineup()
if not lineup:
return []
try:
raw_ids = json.loads(lineup.get('player_ids_json') or '[]')
except (TypeError, json.JSONDecodeError):
return []
if not isinstance(raw_ids, list):
return []
seen = set()
roster_ids = []
for raw_id in raw_ids:
steam_id = str(raw_id).strip()
if steam_id and steam_id not in seen:
seen.add(steam_id)
roster_ids.append(steam_id)
return roster_ids