From d64222ca91cbaea588f23349f556bddc6c051e6e Mon Sep 17 00:00:00 2001 From: Scott Idem Date: Mon, 13 Apr 2026 18:57:03 -0400 Subject: [PATCH] fix(badges): implement missing sort cases for all sort options MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit All four sort options in the dropdown were falling through to the default (given_name ASC) because their cases were missing from both the IDB fast-path sort and the API order_by_li mapping: - Affiliations ASC: IDB sorts by affiliations_override → affiliations; API sorts by affiliations column - Badge Type ASC: badge_type_code ASC - First Printed DESC: print_first_datetime DESC - Last Printed DESC: print_last_datetime DESC Co-Authored-By: Claude Sonnet 4.6 --- .../[event_id]/(badges)/badges/+page.svelte | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/routes/events/[event_id]/(badges)/badges/+page.svelte b/src/routes/events/[event_id]/(badges)/badges/+page.svelte index cfb7cbcc..d8313175 100644 --- a/src/routes/events/[event_id]/(badges)/badges/+page.svelte +++ b/src/routes/events/[event_id]/(badges)/badges/+page.svelte @@ -317,6 +317,26 @@ async function handle_search_refresh(params: any) { ); case 'print_count_desc': return (b.print_count ?? 0) - (a.print_count ?? 0); + case 'print_first_desc': + return ( + new Date(b.print_first_datetime || 0).getTime() - + new Date(a.print_first_datetime || 0).getTime() + ); + case 'print_last_desc': + return ( + new Date(b.print_last_datetime || 0).getTime() - + new Date(a.print_last_datetime || 0).getTime() + ); + case 'badge_type_asc': + return (a.badge_type_code ?? '').localeCompare( + b.badge_type_code ?? '' + ); + case 'affiliations_asc': + return ( + (a.affiliations_override ?? a.affiliations ?? '').localeCompare( + b.affiliations_override ?? b.affiliations ?? '' + ) + ); default: return (a.given_name ?? '').localeCompare( b.given_name ?? '' @@ -372,6 +392,18 @@ async function handle_search_refresh(params: any) { case 'print_count_desc': order_by_li = { print_count: 'DESC' }; break; + case 'print_first_desc': + order_by_li = { print_first_datetime: 'DESC' }; + break; + case 'print_last_desc': + order_by_li = { print_last_datetime: 'DESC' }; + break; + case 'badge_type_asc': + order_by_li = { badge_type_code: 'ASC' }; + break; + case 'affiliations_asc': + order_by_li = { affiliations: 'ASC' }; + break; default: order_by_li = { given_name: 'ASC' }; }