Skip to content

Commit

Permalink
Use Sunday as the start of the week on report
Browse files Browse the repository at this point in the history
  • Loading branch information
marcospri committed Dec 10, 2024
1 parent 5e4f199 commit 969bb5f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ AS $$
ELSE INTERVAL '6 months'
END
))::DATE
WHEN resolution = 'week' THEN
-- -1 day to start weeks on Sunday
(DATE_TRUNC('week', date) - '1 day'::interval)::date
ELSE DATE_TRUNC(resolution, date)::date
END
$$
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ CREATE MATERIALIZED VIEW report.events AS (

translated_events AS (
SELECT
DATE_TRUNC('week', timestamp)::date AS timestamp_week,
report.multi_truncate('week', timestamp) AS timestamp_week,
user_map.organization_id,
event_type.type::report.event_type AS event_type,
user_map.user_id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ CREATE MATERIALIZED VIEW report.group_activity AS (
WITH
launch_counts AS (
SELECT
DATE_TRUNC('week', timestamp)::DATE as timestamp_week,
report.multi_truncate('week', timestamp) AS timestamp_week,
group_id,
COUNT(1) AS launch_count
FROM report.group_map
Expand Down

0 comments on commit 969bb5f

Please sign in to comment.