From 89edd07722eb369192b9a8fa7047f7a367ef3ec4 Mon Sep 17 00:00:00 2001 From: Joerg Date: Thu, 22 Jan 2026 07:52:13 +0100 Subject: [PATCH] feat: make award summary respect mode filter and remove mode from table headers Summary cards (Total, Confirmed, Worked, Needed) now update based on the selected mode filter. Also removed redundant mode display from table column headers since the mode is already visible in the filter dropdown. Co-Authored-By: Claude --- .../src/routes/awards/[id]/+page.svelte | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/frontend/src/routes/awards/[id]/+page.svelte b/src/frontend/src/routes/awards/[id]/+page.svelte index 5ee2ad7..6f2c9dd 100644 --- a/src/frontend/src/routes/awards/[id]/+page.svelte +++ b/src/frontend/src/routes/awards/[id]/+page.svelte @@ -24,6 +24,11 @@ // Get available modes from entities $: availableModes = ['Mixed Mode', ...new Set(entities.map(e => e.mode).filter(Boolean).sort())]; + // Filter entities by selected mode for summary calculations + $: filteredEntities = selectedMode === 'Mixed Mode' + ? entities + : entities.filter(e => e.mode === selectedMode); + onMount(async () => { await loadAwardData(); }); @@ -394,16 +399,16 @@
{#if entities.length > 0 && entities[0].points !== undefined} - {@const earnedPoints = entities.reduce((sum, e) => sum + (e.confirmed ? e.points : 0), 0)} + {@const earnedPoints = filteredEntities.reduce((sum, e) => sum + (e.confirmed ? e.points : 0), 0)} {@const targetPoints = award.target} {@const neededPoints = Math.max(0, targetPoints - earnedPoints)}
Total Combinations: - {entities.length} + {filteredEntities.length}
Confirmed: - {entities.filter((e) => e.confirmed).length} + {filteredEntities.filter((e) => e.confirmed).length}
Points: @@ -418,12 +423,12 @@ {targetPoints}
{:else} - {@const workedCount = entities.filter((e) => e.worked).length} - {@const confirmedCount = entities.filter((e) => e.confirmed).length} - {@const neededCount = award.target ? Math.max(0, award.target - workedCount) : entities.filter((e) => !e.worked).length} + {@const workedCount = filteredEntities.filter((e) => e.worked).length} + {@const confirmedCount = filteredEntities.filter((e) => e.confirmed).length} + {@const neededCount = award.target ? Math.max(0, award.target - workedCount) : filteredEntities.filter((e) => !e.worked).length}
Total: - {entities.length} + {filteredEntities.length}
Confirmed: @@ -460,8 +465,8 @@ Entity - {#each columns as { band, mode }} - {band}{#if mode} {mode}{/if} + {#each columns as { band }} + {band} {/each}