Show daily streak count on leaderboard as well
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user