Show daily streak count on leaderboard as well

This commit is contained in:
Peter Stockings
2026-02-24 21:12:45 +11:00
parent 9323082d37
commit f3abb4781b
4 changed files with 49 additions and 41 deletions

View File

@@ -2,6 +2,7 @@ from flask import Blueprint, render_template
from app.auth import login_required
from app.db import query, query_one
from app import SYDNEY_TZ
from app.utils import calculate_streak
from datetime import timezone
bp = Blueprint("leaderboard", __name__)
@@ -46,11 +47,13 @@ def index():
total_to_lose = start_w - goal
goal_progress = min(100, round((weight_lost / total_to_lose) * 100, 1)) if total_to_lose > 0 else 0
streak = calculate_streak(u["id"])
ranked.append({
**u,
"weight_lost": round(weight_lost, 1),
"pct_lost": pct_lost,
"goal_progress": goal_progress,
"streak": streak["current"],
})
# Sort by % lost (descending)