From 11f56aa986adb5ad60be23736ac29958c3192025 Mon Sep 17 00:00:00 2001 From: Stan Runge Date: Mon, 24 Feb 2025 21:22:04 +0100 Subject: [PATCH] add total points aggregration and percentage --- packages/web/src/routes/progress/+page.svelte | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/web/src/routes/progress/+page.svelte b/packages/web/src/routes/progress/+page.svelte index 3e8c429..a33469d 100755 --- a/packages/web/src/routes/progress/+page.svelte +++ b/packages/web/src/routes/progress/+page.svelte @@ -16,7 +16,14 @@ {/if} - Total progress: {data.tasks.reduce((acc, task) => acc + task.currentPoints, 0)} + Total progress: {data.tasks.reduce((acc, task) => acc + task.currentPoints, 0)} / {data.tasks.reduce( + (acc, task) => acc + task.totalPoints, + 0 + )} ({( + (data.tasks.reduce((acc, task) => acc + task.currentPoints, 0) / + data.tasks.reduce((acc, task) => acc + task.totalPoints, 0)) * + 100 + ).toFixed(1)}%) {#if data.tasks.length > 0}