1.6.2: Refreshed.

This commit is contained in:
2026-01-27 19:23:05 +08:00
parent 92ad093895
commit e019d3e458
4 changed files with 57 additions and 8 deletions

View File

@@ -109,9 +109,12 @@ class OpponentService:
# Post-process for derived stats
results = []
for r in rows:
# Resolve avatar fallback from local static if missing
from web.services.stats_service import StatsService
for r in rows or []:
d = dict(r)
d['win_rate'] = (d['wins'] / d['matches']) if d['matches'] else 0
d['avatar_url'] = StatsService.resolve_avatar_url(d.get('steam_id_64'), d.get('avatar_url'))
results.append(d)
return results, total
@@ -209,6 +212,9 @@ class OpponentService:
info = query_db('l2', "SELECT * FROM dim_players WHERE steam_id_64 = ?", [steam_id], one=True)
if not info:
return None
from web.services.stats_service import StatsService
player = dict(info)
player['avatar_url'] = StatsService.resolve_avatar_url(steam_id, player.get('avatar_url'))
# 2. Match History vs Us (All matches this player played)
# We define "Us" as matches where this player is an opponent.
@@ -333,7 +339,7 @@ class OpponentService:
})
return {
'player': info,
'player': player,
'history': processed_history,
'elo_stats': elo_stats,
'side_stats': dict(side_stats) if side_stats else {}