diff --git a/src/lib/ae_reports/reports_functions.ts b/src/lib/ae_reports/reports_functions.ts index 265e47ae..08a8dcad 100644 --- a/src/lib/ae_reports/reports_functions.ts +++ b/src/lib/ae_reports/reports_functions.ts @@ -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);