Skip to content

Add date range presets to Query page view - #4983

Open
Almost10 wants to merge 2 commits into
plan-player-analytics:masterfrom
Almost10:feature/query-view-presets
Open

Almost10 wants to merge 2 commits into
plan-player-analytics:masterfrom
Almost10:feature/query-view-presets

Conversation

@Almost10

@Almost10 Almost10 commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #4956, as suggested in #4956 (comment)

Adds the date range presets next to "Show a view" on the Query page:

Last 30 days (default), Custom, Last 7 days, Last 24 hours, Current month, Previous month, Current week, Previous week, Current day, Yesterday, Current year, Previous year.

Last 30 days is selected at first because it matches the view's default range. Selecting a preset fills in the fields and moves the graph. Editing a field, zooming the graph or restoring a query with "Edit Query" switches the selector to Custom. All data is left out because the view has no all-data range.

Behaviour changes worth checking

  • Server timezone: the view options now include timeZone and timeZoneOffsetMs, like the date filter options, so presets are calculated in the timezone the server parses the view in.
  • Whole-minute end bound: the view's "to" time now includes its whole minute, like the date filters since Add date range presets to Query page date filters #4956. Without this, Previous month (ending at 23:59) would leave out the last 59 seconds. This also applies to manually entered times. The session summary in the results now also counts a session that starts in the last millisecond of the view, like the players table already did (<= instead of <).
  • Gregorian dates: view dates are parsed with Locale.ROOT, so servers with a non-Gregorian default locale (for example th-TH) read the dashboard's years correctly.

Known limitation

Like the date filter presets, a preset whose start falls in the repeated hour when DST ends can leave out up to one hour, because the dd/MM/yyyy kk:mm format can't tell the two occurrences apart.

Testing

  • New ViewDtoTest (whole-minute end bound, Gregorian parsing under a th-TH default locale) and a SQLite/MySQL test for a session starting exactly at the view's end.
  • Browser tests against a Paper server with sessions on every day boundary and one second before it:
    • every preset filled the expected fields in the server timezone;
    • a Previous month query counted the session at 23:59:59 on the last day (without the backend change it was left out, and presets fell back to UTC);
    • Custom, editing fields, zooming the graph, invalid dates and picking a preset while a typed date was still pending all behaved as expected.
  • Full build and tests (MariaDB and Selenium) pass.

This branch has not been deployed

No deployments
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.

1 participant