From 7104dd077188eeb69b5f426afe2486d3136e810f Mon Sep 17 00:00:00 2001 From: Robin Schanbacher Date: Mon, 3 Aug 2026 18:22:20 +0200 Subject: [PATCH] style: move total to own variable and table footer --- app/evaluation/[days]/[...ical-link]/page.tsx | 46 ++++++++++++++----- 1 file changed, 35 insertions(+), 11 deletions(-) diff --git a/app/evaluation/[days]/[...ical-link]/page.tsx b/app/evaluation/[days]/[...ical-link]/page.tsx index e1819f5..21839bc 100644 --- a/app/evaluation/[days]/[...ical-link]/page.tsx +++ b/app/evaluation/[days]/[...ical-link]/page.tsx @@ -31,9 +31,8 @@ function getCategories(categoriesField: any): string[] { type TimeMap = Record export default async function EvaluationPage({ params }: PageProps) { - let times: TimeMap = { - total: 0 - }; + let times: TimeMap = {}; + let total: number = 0; // get all params const resolvedParams = await params; @@ -79,9 +78,10 @@ export default async function EvaluationPage({ params }: PageProps) { const categories = getCategories(event.categories); categories.forEach((cat) => { - times["total"] = (times["total"] || 0) + durationInMinutes times[cat] = (times[cat] || 0) + durationInMinutes }) + + total = (total || 0) + durationInMinutes }) return ( @@ -91,13 +91,37 @@ export default async function EvaluationPage({ params }: PageProps) { {Object.keys(times).length === 0 ? (

Keine Zeiten erfasst.

) : ( - + // + + + + + + + + + + {Object.entries(times).map(([category, minutes]) => ( + + + + + + ))} + + + + + + + +
CategorieTimePercentage
{category}{Math.floor(minutes / 60)} Std. {minutes % 60} Min. ({minutes} Min. gesamt){Math.round(minutes / total *100 *10)/10}
Total{Math.floor(total / 60)} Std. {total % 60} Min. ({total} Min. gesamt)
)}