Page MenuHomePhabricator

Same start and end date is converted to end=start - 1 day when start/end are today's date
Closed, ResolvedPublic

Description

Hi all,

I've noticed a strange behaviour of https://tools.wmflabs.org/pageviews. When I open https://tools.wmflabs.org/pageviews/?project=cs.wikipedia.org&userlang=cs&start=2019-05-02&end=2019-05-02&pages=Strana_konzervativn%C3%AD_pravice (for reproducing this bug, you need to change both start and end dates to today's date), I get redirected to https://tools.wmflabs.org/pageviews/?project=cs.wikipedia.org&platform=all-access&agent=user&start=2019-05-02&end=2019-05-01&pages=Strana_konzervativn%C3%AD_pravice, which contains different start and end dates.

Original URI: Start 2019-05-02, end 2019-05-02
New URI: Start 2019-05-02, end 2019-05-01

The new URI's dates are nonsense, end cannot be before start.

Event Timeline

Urbanecm created this task.May 2 2019, 9:28 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMay 2 2019, 9:28 PM
kostajh added a subscriber: kostajh.May 2 2019, 9:29 PM

@Urbanecm when I visit that link my URL doesn't change, and start/end are both 5-02. However if I modify your URL to have start/end as 2019-05-03 (today's date), then I end up with 5-03/5-02, which is the bug you've reported.

kostajh renamed this task from Same start and end date is converted to end=start - 1 day to Same start and end date is converted to end=start - 1 day when start/end are today's date.May 3 2019, 1:18 PM

This has something to do with it enforcing the max end date (roughly yesterday at midnight UTC), but it isn't applying the same check to the start date. I'll get a fix out soon.

In case you didn't already know, you can use range=current to get the most recent day's worth of data, e.g. https://tools.wmflabs.org/pageviews/?project=cs.wikipedia.org&pages=Strana_konzervativn%C3%AD_pravice&range=current. The range=latest-N (where N is the number of days) is also a good option if you're trying to show recent pageviews. More at https://tools.wmflabs.org/pageviews/url_structure/

JTannerWMF added a subscriber: JTannerWMF.

This is a bug in the Pageviews tool which is not maintained by Growth Team.

This is a bug in the Pageviews tool which is not maintained by Growth Team.

It's not maintained by Growth-Team, but related to Growth team activities, so I added the tag, as a kind of CC :). However, it's up to the team what they want to have at their board, just wanted to explain :).

This has something to do with it enforcing the max end date (roughly yesterday at midnight UTC), but it isn't applying the same check to the start date. I'll get a fix out soon.

Should that happen? I think any change of incoming data is highly unexpectable, and I personally vote for showing an error rather than trying to "correct" the user's intentions. If you want, feel free to enforce any forms inside your app to have/not have any values, but please do not change values specified directly in the URL. Thanks!

In case you didn't already know, you can use range=current to get the most recent day's worth of data, e.g. https://tools.wmflabs.org/pageviews/?project=cs.wikipedia.org&pages=Strana_konzervativn%C3%AD_pravice&range=current. The range=latest-N (where N is the number of days) is also a good option if you're trying to show recent pageviews. More at https://tools.wmflabs.org/pageviews/url_structure/

Thanks, but the intention wasn't to show the most recent data, but the data from a certain date, which just happened to be today. Illegal date, but that should be handled with an error, in my opinion.

By the way, while testing this, I've noticed an error saying "Data not available" or so.

MusikAnimal closed this task as Resolved.May 29 2019, 7:47 PM
MusikAnimal claimed this task.
MusikAnimal moved this task from In Development to Done on the Tool-Pageviews board.

An error message is shown if you try to enter a date later then the maximum (yesterday at midnight), and it will use the default date range (latest 20 days) instead. This is is consistent with how other invalid parameters are handled.