fix: QA report bugs BUG-01 through BUG-11 resolved - streak modal close btn, calculator crash guard, AI chat auto-scroll, leaderboard zero-streak fix, name annotation cleanup everywhere, CBT score display colors, PrepPilot difficulty badge layout
This commit is contained in:
@@ -8,6 +8,7 @@ from uuid import UUID
|
||||
from datetime import datetime, timedelta, date
|
||||
from pydantic import BaseModel
|
||||
import os
|
||||
import re
|
||||
|
||||
from database import init_db, get_session
|
||||
import models
|
||||
@@ -838,14 +839,14 @@ def get_leaderboard(
|
||||
# Calculate real user's stats
|
||||
user_score = 0
|
||||
user_accuracy = "0%"
|
||||
user_streak = 1
|
||||
user_streak = 0 # BUG-04 fix: real zero for new users (no artificial min floor)
|
||||
if requesting_user:
|
||||
if str(requesting_user.id) in DEMO_USER_UUIDS:
|
||||
user_score = 9250
|
||||
user_accuracy = "88.5%"
|
||||
user_streak = requesting_user.streak_count or 25
|
||||
else:
|
||||
user_streak = max(1, requesting_user.streak_count)
|
||||
user_streak = requesting_user.streak_count or 0 # BUG-04 fix: 0 is valid
|
||||
user_attempts = session.exec(
|
||||
select(models.Attempt).where(
|
||||
models.Attempt.user_id == requesting_user.id,
|
||||
@@ -871,10 +872,11 @@ def get_leaderboard(
|
||||
"isCurrentUser": False,
|
||||
})
|
||||
|
||||
# Add the requesting real user
|
||||
# Add the requesting real user — strip role annotations from display name
|
||||
if requesting_user:
|
||||
clean_name = re.sub(r'\s*\([^)]*\)\s*$', '', requesting_user.name).strip()
|
||||
entries.append({
|
||||
"name": requesting_user.name,
|
||||
"name": clean_name,
|
||||
"score": user_score,
|
||||
"accuracy": user_accuracy,
|
||||
"streak": user_streak,
|
||||
|
||||
Reference in New Issue
Block a user