From dc06cfff374dd28680379b701ae8fb5ad05f4e8b Mon Sep 17 00:00:00 2001 From: Dona Maria Absi <49731027+DonaAbsi@users.noreply.github.com> Date: Thu, 8 May 2025 10:59:47 +0300 Subject: [PATCH] removed month to event_date --- .../procedure_insert_fact_daily_space_occupancy.sql | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libs/common/src/sql/procedures/fact_space_occupancy/procedure_insert_fact_daily_space_occupancy.sql b/libs/common/src/sql/procedures/fact_space_occupancy/procedure_insert_fact_daily_space_occupancy.sql index 13c8d6a..7580f91 100644 --- a/libs/common/src/sql/procedures/fact_space_occupancy/procedure_insert_fact_daily_space_occupancy.sql +++ b/libs/common/src/sql/procedures/fact_space_occupancy/procedure_insert_fact_daily_space_occupancy.sql @@ -1,7 +1,6 @@ --- will return the presence metrics for the days of the selected month WITH params AS ( SELECT - TO_DATE(NULLIF($2, ''), 'YYYY-MM') AS month, + TO_DATE(NULLIF($2, ''), 'YYYY-MM-DD') AS event_date, $4::text AS device_id ), @@ -31,7 +30,7 @@ device_logs AS ( WHERE product.cat_name = 'hps' AND "device-status-log".code = 'presence_state' 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 (