Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Week's Longest Day uses UTC time #187

Open
rphovley opened this issue Aug 29, 2024 · 0 comments
Open

Week's Longest Day uses UTC time #187

rphovley opened this issue Aug 29, 2024 · 0 comments
Labels
bug Something isn't working important not urgent Will be impactful to our users but not urgent

Comments

@rphovley
Copy link
Member

Currently, the week's longest day uses UTC time while the rest of the numbers use the local time based on how we group the days

WITH get_total_minutes (time, total_minutes) AS (
    SELECT time, count() * 2 as total_minutes
    FROM activities_pulse
    WHERE date(activities_pulse.time) BETWEEN :startDate AND :endDate
    GROUP BY category, strftime('%s', time) / 120),
get_day_minutes (time, day_minutes) AS (
    SELECT time, count() * 2 as day_minutes 
    FROM get_total_minutes
    GROUP BY strftime('%Y-%m-%d', time))
SELECT max(day_minutes) as minutes
FROM get_day_minutes;

Specifically:

GROUP BY strftime('%Y-%m-%d', time))

chops off the hour so the days are grouped strictly by UTC

@rphovley rphovley added bug Something isn't working important not urgent Will be impactful to our users but not urgent labels Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working important not urgent Will be impactful to our users but not urgent
Projects
None yet
Development

No branches or pull requests

1 participant