Compare commits
2 Commits
acf0a13955
...
f6051156cf
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f6051156cf | ||
|
|
d64222ca91 |
@@ -218,9 +218,10 @@ async function handle_search_refresh(params: any) {
|
|||||||
const min_chars = params.min_chars;
|
const min_chars = params.min_chars;
|
||||||
|
|
||||||
// Defense-in-depth: enforce min_chars even if the search component lets one through.
|
// Defense-in-depth: enforce min_chars even if the search component lets one through.
|
||||||
// Exception: if the user has set a non-default filter (printed status, type, affiliations),
|
// Exception: if the user has set a non-default filter or sort, that is explicit intent —
|
||||||
// that is an explicit intent — run the search even without a text query.
|
// run the search even without a text query.
|
||||||
const has_active_filters = printed_status !== 'all' || !!type_code || !!aff_str;
|
const has_active_filters =
|
||||||
|
printed_status !== 'all' || !!type_code || !!aff_str || !!params.sort;
|
||||||
if (qry_str.length < min_chars && !has_active_filters) {
|
if (qry_str.length < min_chars && !has_active_filters) {
|
||||||
untrack(() => {
|
untrack(() => {
|
||||||
event_badge_id_li = [];
|
event_badge_id_li = [];
|
||||||
@@ -317,6 +318,26 @@ async function handle_search_refresh(params: any) {
|
|||||||
);
|
);
|
||||||
case 'print_count_desc':
|
case 'print_count_desc':
|
||||||
return (b.print_count ?? 0) - (a.print_count ?? 0);
|
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:
|
default:
|
||||||
return (a.given_name ?? '').localeCompare(
|
return (a.given_name ?? '').localeCompare(
|
||||||
b.given_name ?? ''
|
b.given_name ?? ''
|
||||||
@@ -372,6 +393,18 @@ async function handle_search_refresh(params: any) {
|
|||||||
case 'print_count_desc':
|
case 'print_count_desc':
|
||||||
order_by_li = { print_count: 'DESC' };
|
order_by_li = { print_count: 'DESC' };
|
||||||
break;
|
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:
|
default:
|
||||||
order_by_li = { given_name: 'ASC' };
|
order_by_li = { given_name: 'ASC' };
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user