removed month to event_date

This commit is contained in:
Dona Maria Absi
2025-05-08 10:59:47 +03:00
parent 10005c7897
commit dc06cfff37

View File

@ -1,7 +1,6 @@
-- will return the presence metrics for the days of the selected month
WITH params AS ( WITH params AS (
SELECT SELECT
TO_DATE(NULLIF($2, ''), 'YYYY-MM') AS month, TO_DATE(NULLIF($2, ''), 'YYYY-MM-DD') AS event_date,
$4::text AS device_id $4::text AS device_id
), ),
@ -31,7 +30,7 @@ device_logs AS (
WHERE product.cat_name = 'hps' WHERE product.cat_name = 'hps'
AND "device-status-log".code = 'presence_state' AND "device-status-log".code = 'presence_state'
AND device.uuid::text = P.device_id AND device.uuid::text = P.device_id
AND (P.month IS NULL OR date_trunc('month', "device-status-log".event_time) = P.month) AND (P.event_date IS NULL OR "device-status-log".event_time = P.event_date)
), ),
presence_detection AS ( presence_detection AS (