From 39795cd3c9b360083059183898d0df5fa45ab23c Mon Sep 17 00:00:00 2001 From: Joerg Date: Mon, 19 Jan 2026 16:56:09 +0100 Subject: [PATCH] feat: add sum row to award details table Add a summary row at the bottom of the award details table that shows the sum for each band column. The sum automatically calculates: - For points-based awards: Total confirmed points per band - For QSO-based awards: Count of confirmed QSOs per band The sum row is styled with a gray background and bold text for visual distinction. Co-Authored-By: Claude Sonnet 4.5 --- .../src/routes/awards/[id]/+page.svelte | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/src/frontend/src/routes/awards/[id]/+page.svelte b/src/frontend/src/routes/awards/[id]/+page.svelte index f80f9f3..9408263 100644 --- a/src/frontend/src/routes/awards/[id]/+page.svelte +++ b/src/frontend/src/routes/awards/[id]/+page.svelte @@ -164,6 +164,28 @@ applyFilter(); } + // Calculate band sums + $: bandSums = (() => { + const sums = new Map(); + const hasPoints = entities.length > 0 && entities[0].points !== undefined; + + bands.forEach(band => { + if (hasPoints) { + // Sum points for confirmed QSOs in this band + const sum = entities + .filter(e => e.band === band && e.confirmed) + .reduce((total, e) => total + (e.points || 0), 0); + sums.set(band, sum); + } else { + // Count confirmed QSOs in this band + const count = entities.filter(e => e.band === band && e.confirmed).length; + sums.set(band, count); + } + }); + + return sums; + })(); + // QSO Detail Modal Functions async function openQSODetailModal(qso) { loadingQSO = true; @@ -341,6 +363,19 @@ {/each} + + + + Sum + + {#each bands as band} + {@const sum = bandSums.get(band) ?? 0} + + {sum} + + {/each} + + {/if} @@ -559,6 +594,28 @@ padding: 0px 3px 0px 3px; } + .award-table tfoot { + background-color: #f5f5f5; + border-top: 2px solid #333; + } + + .sum-row td { + border: 1px solid #000; + padding: 8px 5px; + text-align: center; + background-color: #f5f5f5; + font-weight: 600; + } + + .sum-label { + text-align: left !important; + color: #333; + } + + .sum-cell { + color: #4a90e2; + } + .award-header { margin-bottom: 2rem; }