From 5af41a8a2c562016f311b247edfe1702ae584803 Mon Sep 17 00:00:00 2001 From: Ronny Date: Sat, 11 Apr 2026 21:05:23 +0200 Subject: [PATCH] fix: accuracy 1000% bug, Spiele nav icon, light mode polish - Backend: parseInt for leaderboard values from PostgreSQL (string concatenation "1"+"0"="10" caused 1000% accuracy) - BottomNav: Swords icon instead of emoji for Spiele tab - Light mode: stronger card shadows and shine gradient Co-Authored-By: Claude Opus 4.6 (1M context) --- backend/src/routes/leaderboard.ts | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/backend/src/routes/leaderboard.ts b/backend/src/routes/leaderboard.ts index 1af2de3..01e1b59 100644 --- a/backend/src/routes/leaderboard.ts +++ b/backend/src/routes/leaderboard.ts @@ -101,24 +101,22 @@ router.get('/me', async (req: Request, res: Response): Promise => { const evaluatedCount = parseInt(tipsStats?.count ?? '0'); const wrongCount = parseInt(tipsStats?.wrong_count ?? '0'); + const exactCount = parseInt(String(lb?.exact_count ?? '0')); + const tendencyCount = parseInt(String(lb?.tendency_count ?? '0')); const accuracy = evaluatedCount > 0 - ? Math.round( - (((lb?.exact_count ?? 0) + (lb?.tendency_count ?? 0)) / - evaluatedCount) * - 100 - ) + ? Math.round(((exactCount + tendencyCount) / evaluatedCount) * 100) : 0; const response: UserStatsResponse = { userId, fullName: lb?.full_name ?? req.staffbaseUser!.name ?? 'Unbekannt', team: lb?.team ?? null, - totalPoints: lb?.total_points ?? 0, - rank: lb?.rank ?? null, - tipsCount: lb?.tips_count ?? 0, - exactCount: lb?.exact_count ?? 0, - tendencyCount: lb?.tendency_count ?? 0, + totalPoints: parseInt(String(lb?.total_points ?? '0')), + rank: lb?.rank ? parseInt(String(lb.rank)) : null, + tipsCount: parseInt(String(lb?.tips_count ?? '0')), + exactCount, + tendencyCount, wrongCount, accuracy, };