fix: accuracy 1000% bug, Spiele nav icon, light mode polish
Build & Deploy Tippspiel / build (push) Successful in 50s
Build & Deploy Tippspiel / build (push) Successful in 50s
- 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) <noreply@anthropic.com>
This commit is contained in:
@@ -101,24 +101,22 @@ router.get('/me', async (req: Request, res: Response): Promise<void> => {
|
|||||||
|
|
||||||
const evaluatedCount = parseInt(tipsStats?.count ?? '0');
|
const evaluatedCount = parseInt(tipsStats?.count ?? '0');
|
||||||
const wrongCount = parseInt(tipsStats?.wrong_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 =
|
const accuracy =
|
||||||
evaluatedCount > 0
|
evaluatedCount > 0
|
||||||
? Math.round(
|
? Math.round(((exactCount + tendencyCount) / evaluatedCount) * 100)
|
||||||
(((lb?.exact_count ?? 0) + (lb?.tendency_count ?? 0)) /
|
|
||||||
evaluatedCount) *
|
|
||||||
100
|
|
||||||
)
|
|
||||||
: 0;
|
: 0;
|
||||||
|
|
||||||
const response: UserStatsResponse = {
|
const response: UserStatsResponse = {
|
||||||
userId,
|
userId,
|
||||||
fullName: lb?.full_name ?? req.staffbaseUser!.name ?? 'Unbekannt',
|
fullName: lb?.full_name ?? req.staffbaseUser!.name ?? 'Unbekannt',
|
||||||
team: lb?.team ?? null,
|
team: lb?.team ?? null,
|
||||||
totalPoints: lb?.total_points ?? 0,
|
totalPoints: parseInt(String(lb?.total_points ?? '0')),
|
||||||
rank: lb?.rank ?? null,
|
rank: lb?.rank ? parseInt(String(lb.rank)) : null,
|
||||||
tipsCount: lb?.tips_count ?? 0,
|
tipsCount: parseInt(String(lb?.tips_count ?? '0')),
|
||||||
exactCount: lb?.exact_count ?? 0,
|
exactCount,
|
||||||
tendencyCount: lb?.tendency_count ?? 0,
|
tendencyCount,
|
||||||
wrongCount,
|
wrongCount,
|
||||||
accuracy,
|
accuracy,
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user