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

Fix weekly report time range #951

Merged
merged 2 commits into from
Apr 22, 2021
Merged

Fix weekly report time range #951

merged 2 commits into from
Apr 22, 2021

Conversation

ukutaht
Copy link
Contributor

@ukutaht ukutaht commented Apr 22, 2021

Changes

Bug: weekly reports are sent out on Monday. The time range that stats are calculated for are using the Query.from(%{"period" => "7d"}) which is problematic because:

  • The resulting date range is last Tuesday -> this Monday
  • Stats for 'this Monday' are incomplete, so sending a report is for that is wrong

The correct date range is 'last monday' -> 'last sunday'. The stats for that range are complete and that's what most people consider a 'week'.

Tests

  • Automated tests have been added

Changelog

  • Entry has been added to changelog

Documentation

  • This change does not need a documentation update

@ukutaht ukutaht merged commit b8baefe into master Apr 22, 2021
@ukutaht ukutaht deleted the fix-weekly-reports branch April 22, 2021 09:11
@anmipo
Copy link

anmipo commented Apr 22, 2021

The correct date range is 'last monday' -> 'last sunday'. The stats for that range are complete and that's what most people consider a 'week'.

I don't want to throw a wrench, but "most people" is perhaps too optimistic:

the United States, Canada, Brazil, Japan and other countries consider Sunday as the first day of the week

the week begins with Saturday in much of the Middle East

[Source: Wikipedia]

@ukutaht
Copy link
Contributor Author

ukutaht commented Apr 22, 2021

Sure, in the future we can offer customizations so people can choose.

Meanwhile we need to choose something as the default. I think the secular ISO-8601 standard (week starting with Monday) is the most reasonable and inclusive. Other standards come from certain religions and I really don't want to get in the business of choosing whether we should use the Bible or the Quran as the source of truth :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants