From 06ffde67f49d9866b3b91968bf143853e509d7cb Mon Sep 17 00:00:00 2001 From: Yasen Pramatarov Date: Thu, 1 Aug 2024 10:52:39 +0300 Subject: [PATCH] Fixes SQL --- public_html/classes/queries.php | 48 ++++++++++++++++++++++++--------- 1 file changed, 36 insertions(+), 12 deletions(-) diff --git a/public_html/classes/queries.php b/public_html/classes/queries.php index 05a0983..8d2bfd1 100644 --- a/public_html/classes/queries.php +++ b/public_html/classes/queries.php @@ -67,19 +67,43 @@ ORDER BY 'conferences_all_formatted' => " SELECT DISTINCT c.jitsi_component, - (SELECT ce.time - FROM conference_events ce - WHERE - ce.conference_id = c.conference_id - AND - ce.conference_event = 'conference created') + (SELECT COALESCE + ( + (SELECT ce.time + FROM conference_events ce + WHERE + ce.conference_id = c.conference_id + AND + ce.conference_event = 'conference created' + ), + (SELECT ce.time + FROM conference_events ce + WHERE + ce.conference_id = c.conference_id + AND + ce.conference_event = 'bridge selected' + ) + ) + ) AS start, - (SELECT ce.time - FROM conference_events ce - WHERE - ce.conference_id = c.conference_id - AND - ce.conference_event = 'conference expired') + (SELECT COALESCE + ( + (SELECT ce.time + FROM conference_events ce + WHERE + ce.conference_id = c.conference_id + AND + (ce.conference_event = 'conference expired' OR ce.conference_event = 'conference stopped') + ), + (SELECT pe.time + FROM participant_events pe + WHERE + pe.event_param = c.conference_id + ORDER BY pe.time DESC + LIMIT 1 + ) + ) + ) AS end, c.conference_id, c.conference_name,