fix(reports): resolve TypeError in Jitsi reports and restore filtering

- Added Array.isArray check to prevent 'not iterable' error on API failure responses.
- Restored params_json to narrow the activity_log query and prevent potential timeouts.
- Cleaned up minor whitespace in sort logic.
This commit is contained in:
Scott Idem
2026-01-26 12:12:11 -05:00
parent 766225f5b9
commit 72464d1a31

View File

@@ -45,15 +45,13 @@ export async function load_jitsi_report({
// use_alt_mdl: true,
enabled: 'all',
hidden: 'all',
// order_by_li: { created_on: 'DESC' },
limit: 500, // Fetch a reasonable number of recent logs
// order_by_li: { created_on: 'DESC' },
// params_json: params_json,
params_json: params_json,
log_lvl: 2
});
if (!flat_log_list || flat_log_list.length === 0) {
if (log_lvl) console.log('No Jitsi activity logs found.');
if (!flat_log_list || !Array.isArray(flat_log_list) || flat_log_list.length === 0) {
if (log_lvl) console.log('No Jitsi activity logs found or error occurred.');
return [];
}
@@ -107,7 +105,7 @@ export async function load_jitsi_report({
}
const final_report = Array.from(meetings.values());
final_report.sort((a,b) => new Date(b.start_time).getTime() - new Date(a.start_time).getTime());
final_report.sort((a, b) => new Date(b.start_time).getTime() - new Date(a.start_time).getTime());
if (log_lvl) console.log('Final Jitsi report:', final_report);