fix: use file_count_all + is_null for sessions-without-files query

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 <noreply@anthropic.com>
This commit is contained in:
Scott Idem
2026-04-02 19:08:43 -04:00
parent cf7203daaf
commit 5971ca6143

View File

@@ -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({