Skip to content

Commit

Permalink
Update ZCA route badges
Browse files Browse the repository at this point in the history
  • Loading branch information
oldnapalm committed Feb 16, 2024
1 parent ed2f41c commit 74c64aa
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions zwift_offline.py
Original file line number Diff line number Diff line change
Expand Up @@ -3291,10 +3291,11 @@ def api_route_results_completion_stats_all():
for achievement in achievements.achievements:
if achievement.id in GD['achievements']:
badges.append(GD['achievements'][achievement.id])
if db.session.execute(sqlalchemy.text("SELECT COUNT(*) FROM route_result WHERE player_id = :p"), {"p": player_id}).scalar() < len(badges):
for badge in badges:
results = [r[0] for r in db.session.execute(sqlalchemy.text("SELECT route_hash FROM route_result WHERE player_id = :p"), {"p": player_id})]
for badge in badges:
if not badge in results:
db.session.add(RouteResult(player_id=player_id, route_hash=badge))
db.session.commit()
db.session.commit()
stats = []
rows = db.session.execute(sqlalchemy.text("SELECT route_hash, min(world_time) AS first, max(world_time) AS last FROM route_result WHERE player_id = :p GROUP BY route_hash"), {"p": player_id})
for row in rows:
Expand Down

0 comments on commit 74c64aa

Please sign in to comment.