fix(badges): fix Printed/Not Printed filter visibility and API query
Two bugs: 1. visible_badge_obj_li gated on trusted+edit_mode, but the filter dropdown is also accessible to manager+ without edit_mode. Changed gate to (trusted+edit) || manager_access to match the filter's own access condition. 2. not_printed API query used print_count eq 0, which does not match NULL in SQL. Unprinted badges have print_count = NULL, so the API was returning 0 results and overwriting the correct IDB fast-path results. Removed the not_printed condition from the API query — IDB fast path (print_count ?? 0) < 1 and visible_badge_obj_li both handle NULL correctly and are the authoritative filter for that case. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -501,9 +501,10 @@ export async function search__event_badge({
|
||||
|
||||
if (printed_status === 'printed') {
|
||||
search_query.and.push({ field: 'print_count', op: 'gt', value: 0 });
|
||||
} else if (printed_status === 'not_printed') {
|
||||
search_query.and.push({ field: 'print_count', op: 'eq', value: 0 });
|
||||
}
|
||||
// 'not_printed' intentionally omitted from the API query: unprinted badges have
|
||||
// print_count = NULL (never set), and `eq 0` in SQL does not match NULL.
|
||||
// The IDB fast path (print_count ?? 0) < 1 and visible_badge_obj_li handle this correctly.
|
||||
|
||||
if (enabled === 'enabled')
|
||||
search_query.and.push({ field: 'enable', op: 'eq', value: true });
|
||||
|
||||
Reference in New Issue
Block a user