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)
)}