vrk-kpa / ckanext-matomo

GNU Affero General Public License v3.0
3 stars 3 forks source link

AV-1969: Update report time options texts #22

Closed eetumans closed 1 year ago

eetumans commented 1 year ago

https://jira.dvv.fi/browse/AV-1969

This updates the time option texts from week, month, year to past week, past month, past year (via translations in ytp_main translations.py) and the actual date ranges to use relativedelta - week, -month and -year instead of -7 days, -30 days, -365 days respectively.

I also added an unrequested change in form of explicit date range mention in the UI to avoid confusion with ambiguity of statements like last week, past week, previous week etc. Current implementation is set to be from second before midnight YESTERDAY to 00:00:00 a WEEK/MONTH/YEAR from that.

Example on 2023-03-21 14:11:42 week = 2023-03-13 00:00:00 - 2023-03-20 23:59:59 month = 2023-02-20 00:00:00 - 2023-03-20 23:59:59 year = 2022-03-20 00:00:00 - 2023-03-20 23:59:59

Is this correct or incorrect behaviour? Technically that's not a week since it includes twice the weekday which happened to be yesterday. I.e. 13th of march 2023 was a monday and 20th was a monday. Should it instead be from tuesday 14th 00:00:00 to monday 20th 23:59:59?

In month and year it's more sensible I guess as it was discussed to be date to date a month or a year previous unless I recall that incorrectly.

coveralls commented 1 year ago

Pull Request Test Coverage Report for Build 4488766546


Changes Missing Coverage Covered Lines Changed/Added Lines %
ckanext/matomo/helpers.py 3 6 50.0%
ckanext/matomo/reports.py 1 7 14.29%
<!-- Total: 4 13 30.77% -->
Files with Coverage Reduction New Missed Lines %
ckanext/matomo/reports.py 3 29.55%
<!-- Total: 3 -->
Totals Coverage Status
Change from base Build 4488560035: 0.1%
Covered Lines: 506
Relevant Lines: 1315

💛 - Coveralls
eetumans commented 1 year ago

Upon discussion it was decided that last week should indeed be 7 days so instead of being -week from yesterday to yesterday it was changed to be -week from today.

Example on 2023-03-21 14:11:42 week = 2023-03-14 00:00:00 - 2023-03-20 23:59:59 month = 2023-02-20 00:00:00 - 2023-03-20 23:59:59 year = 2022-03-20 00:00:00 - 2023-03-20 23:59:59