From 5792a98dca58c0e890b4f98a6e0b63bf5b27477a Mon Sep 17 00:00:00 2001 From: Joerg Date: Thu, 22 Jan 2026 08:10:24 +0100 Subject: [PATCH] feat: sort band columns by wavelength instead of alphabetically Band columns are now sorted by wavelength (longest to shortest): 160m, 80m, 60m, 40m, 30m, 20m, 17m, 15m, 12m, 10m, 6m, 2m, 70cm, SAT. Unknown bands are sorted to the end. Co-Authored-By: Claude --- .../src/routes/awards/[id]/+page.svelte | 26 +++++++++++++++---- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/src/frontend/src/routes/awards/[id]/+page.svelte b/src/frontend/src/routes/awards/[id]/+page.svelte index cd09ce5..00a1c01 100644 --- a/src/frontend/src/routes/awards/[id]/+page.svelte +++ b/src/frontend/src/routes/awards/[id]/+page.svelte @@ -24,6 +24,9 @@ // Get available modes from entities $: availableModes = ['Mixed Mode', ...new Set(entities.map(e => e.mode).filter(Boolean).sort())]; + // Band order by wavelength (longest to shortest), SAT at the end + const bandOrder = ['160m', '80m', '60m', '40m', '30m', '20m', '17m', '15m', '12m', '10m', '6m', '2m', '70cm', 'SAT', '23cm', '13cm', '9cm', '6cm', '3cm']; + // Filter entities by selected mode for summary calculations $: filteredEntities = selectedMode === 'Mixed Mode' ? entities @@ -167,9 +170,15 @@ } }) .sort((a, b) => { - // Sort by band first, then mode (if present) - const bandCompare = (a.band || '').localeCompare(b.band || ''); - if (bandCompare !== 0) return bandCompare; + // Sort by band order (by wavelength), then by mode + const aBandIndex = bandOrder.indexOf(a.band); + const bBandIndex = bandOrder.indexOf(b.band); + const aIndex = aBandIndex === -1 ? 999 : aBandIndex; + const bIndex = bBandIndex === -1 ? 999 : bBandIndex; + + if (aIndex !== bIndex) return aIndex - bIndex; + + // Same band, sort by mode if present if (a.mode !== undefined && b.mode !== undefined) { return (a.mode || '').localeCompare(b.mode || ''); } @@ -258,8 +267,15 @@ } }) .sort((a, b) => { - const bandCompare = (a.band || '').localeCompare(b.band || ''); - if (bandCompare !== 0) return bandCompare; + // Sort by band order (by wavelength), then by mode + const aBandIndex = bandOrder.indexOf(a.band); + const bBandIndex = bandOrder.indexOf(b.band); + const aIndex = aBandIndex === -1 ? 999 : aBandIndex; + const bIndex = bBandIndex === -1 ? 999 : bBandIndex; + + if (aIndex !== bIndex) return aIndex - bIndex; + + // Same band, sort by mode if present if (a.mode !== undefined && b.mode !== undefined) { return (a.mode || '').localeCompare(b.mode || ''); }