feat: Add recent performance stability stats (matches/days) to player profile

This commit is contained in:
2026-01-28 14:04:32 +08:00
commit 48f1f71d3a
104 changed files with 17572 additions and 0 deletions

38
web/debug_roster.py Normal file
View File

@@ -0,0 +1,38 @@
from web.services.web_service import WebService
from web.services.stats_service import StatsService
import json
def debug_roster():
print("--- Debugging Roster Stats ---")
lineups = WebService.get_lineups()
if not lineups:
print("No lineups found via WebService.")
return
raw_json = lineups[0]['player_ids_json']
print(f"Raw JSON: {raw_json}")
try:
roster_ids = json.loads(raw_json)
print(f"Parsed IDs (List): {roster_ids}")
print(f"Type of first ID: {type(roster_ids[0])}")
except Exception as e:
print(f"JSON Parse Error: {e}")
return
target_id = roster_ids[0] # Pick first one
print(f"\nTesting for Target ID: {target_id} (Type: {type(target_id)})")
# Test StatsService
dist = StatsService.get_roster_stats_distribution(target_id)
print(f"\nDistribution Result: {dist}")
# Test Basic Stats
basic = StatsService.get_player_basic_stats(str(target_id))
print(f"\nBasic Stats for {target_id}: {basic}")
if __name__ == "__main__":
from web.app import create_app
app = create_app()
with app.app_context():
debug_roster()