From 5971ca6143a0e27b78b5163d3fb5427e0500f9a9 Mon Sep 17 00:00:00 2001 From: Scott Idem Date: Thu, 2 Apr 2026 19:08:43 -0400 Subject: [PATCH] fix: use file_count_all + is_null for sessions-without-files query MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two corrections to the qry_files filter: 1. Switch from file_count to file_count_all — covers files on presentations and presenters under the session, not just direct session files. 2. Switch "without files" from eq:0 to is_null — the view uses a LEFT JOIN so sessions with no files get NULL, never 0. Co-Authored-By: Claude Sonnet 4.6 --- src/lib/ae_events/ae_events__event_session.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/lib/ae_events/ae_events__event_session.ts b/src/lib/ae_events/ae_events__event_session.ts index 8c32ab1b..1834b879 100644 --- a/src/lib/ae_events/ae_events__event_session.ts +++ b/src/lib/ae_events/ae_events__event_session.ts @@ -734,15 +734,19 @@ export async function search__event_session({ }); } - // qry_files: true = sessions WITH files (file_count > 0) - // false = sessions WITHOUT files (file_count = 0) - // Requires the 'alt' view which includes file_count via v_event_session_w_file_count. + // qry_files: true = sessions WITH files (file_count_all > 0) + // false = sessions WITHOUT files (file_count_all IS NULL) + // Uses file_count_all which covers files linked to the session AND its + // presentations/presenters — so a session only shows as "without files" + // if no one under it has uploaded anything. + // Requires the 'alt' view (v_event_session_w_file_count) for file_count_all. + // NULL vs 0: LEFT JOIN returns NULL for sessions with no matching files — not 0. if (qry_files === true) { view = 'alt'; - search_query.and.push({ field: 'file_count', op: 'gt', value: 0 }); + search_query.and.push({ field: 'file_count_all', op: 'gt', value: 0 }); } else if (qry_files === false) { view = 'alt'; - search_query.and.push({ field: 'file_count', op: 'eq', value: 0 }); + search_query.and.push({ field: 'file_count_all', op: 'is_null' }); } const result_li = await api.search_ae_obj({