From 941a6cc2676b16d07bbb133b65425a81ef13c522 Mon Sep 17 00:00:00 2001 From: Marcos Prieto Date: Tue, 17 Dec 2024 10:50:22 +0100 Subject: [PATCH] Fix report queries with a date type cast The multi_truncate function takes a date but we where passing a timestamp instead. Cast the type accordingly. --- .../02_entities/03_events/01_create_view.sql | 2 +- .../02_groups/03_group_activity/01_create_view.jinja2.sql | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lms/data_tasks/report/create_from_scratch/02_entities/03_events/01_create_view.sql b/lms/data_tasks/report/create_from_scratch/02_entities/03_events/01_create_view.sql index 746badc2e6..700aa535d5 100644 --- a/lms/data_tasks/report/create_from_scratch/02_entities/03_events/01_create_view.sql +++ b/lms/data_tasks/report/create_from_scratch/02_entities/03_events/01_create_view.sql @@ -23,7 +23,7 @@ CREATE MATERIALIZED VIEW report.events AS ( translated_events AS ( SELECT - report.multi_truncate('week', timestamp) AS timestamp_week, + report.multi_truncate('week', timestamp::date) AS timestamp_week, user_map.organization_id, event_type.type::report.event_type AS event_type, user_map.user_id diff --git a/lms/data_tasks/report/create_from_scratch/05_activity_counts/02_groups/03_group_activity/01_create_view.jinja2.sql b/lms/data_tasks/report/create_from_scratch/05_activity_counts/02_groups/03_group_activity/01_create_view.jinja2.sql index f14735cdff..42a22f01b1 100644 --- a/lms/data_tasks/report/create_from_scratch/05_activity_counts/02_groups/03_group_activity/01_create_view.jinja2.sql +++ b/lms/data_tasks/report/create_from_scratch/05_activity_counts/02_groups/03_group_activity/01_create_view.jinja2.sql @@ -6,7 +6,7 @@ CREATE MATERIALIZED VIEW report.group_activity AS ( WITH launch_counts AS ( SELECT - report.multi_truncate('week', timestamp) AS timestamp_week, + report.multi_truncate('week', timestamp::date) AS timestamp_week, group_id, COUNT(1) AS launch_count FROM report.group_map