mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-11-26 12:14:54 +00:00
removed month to event_date
This commit is contained in:
@ -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 (
|
||||||
|
|||||||
Reference in New Issue
Block a user