Statistiken und Analytics im dashboard gefixed

This commit is contained in:
2025-09-16 01:40:40 +02:00
parent 10a150cb39
commit 69e3985af3
2 changed files with 182 additions and 36 deletions

View File

@@ -2990,9 +2990,9 @@ async function getPerformanceTrends(playerId) {
((avgTimeLastWeek - avgTimeThisWeek) / avgTimeLastWeek * 100) : 0;
return {
avgTimeThisWeek: avgTimeThisWeek,
avgTimeLastWeek: avgTimeLastWeek,
improvement: Math.round(improvement * 10) / 10
avgTimeThisWeek: Math.round(avgTimeThisWeek * 100) / 100,
avgTimeLastWeek: Math.round(avgTimeLastWeek * 100) / 100,
improvement: Math.round(improvement * 100) / 100
};
}
@@ -3028,7 +3028,7 @@ async function getActivityStats(playerId) {
return {
runsToday: parseInt(todayResult.rows[0].count),
runsThisWeek: parseInt(weekResult.rows[0].count),
avgRunsPerDay: parseFloat(avgResult.rows[0].avg_runs) || 0
avgRunsPerDay: Math.round((parseFloat(avgResult.rows[0].avg_runs) || 0) * 100) / 100
};
}
@@ -3048,7 +3048,7 @@ async function getLocationPerformance(playerId) {
return result.rows.map(row => ({
name: row.name,
bestTime: convertTimeToSeconds(row.best_time),
bestTime: Math.round(convertTimeToSeconds(row.best_time) * 100) / 100,
runs: parseInt(row.runs)
}));
}
@@ -3086,7 +3086,7 @@ async function getMonthlyStats(playerId) {
return {
runsThisMonth: parseInt(thisMonthResult.rows[0].count),
runsLastMonth: parseInt(lastMonthResult.rows[0].count),
bestTimeThisMonth: convertTimeToSeconds(bestTimeResult.rows[0].best_time) || 0
bestTimeThisMonth: Math.round((convertTimeToSeconds(bestTimeResult.rows[0].best_time) || 0) * 100) / 100
};
}
@@ -3103,7 +3103,7 @@ async function getPersonalRecords(playerId) {
`, [playerId]);
return result.rows.map(row => ({
time: convertTimeToSeconds(row.recorded_time),
time: Math.round(convertTimeToSeconds(row.recorded_time) * 100) / 100,
location: row.location
}));
}
@@ -3125,9 +3125,9 @@ async function getConsistencyMetrics(playerId) {
Math.max(0, Math.min(100, (1 - (stddevSeconds / avgSeconds)) * 100)) : 0;
return {
averageTime: avgSeconds,
timeDeviation: stddevSeconds,
consistencyScore: Math.round(consistencyScore)
averageTime: Math.round(avgSeconds * 100) / 100,
timeDeviation: Math.round(stddevSeconds * 100) / 100,
consistencyScore: Math.round(consistencyScore * 100) / 100
};
}