Repository navigation
Show annotations in a partial first week bucket - #6966
Open
farisbasha wants to merge 1 commit into
Open
farisbasha wants to merge 1 commit into
farisbasha wants to merge 1 commit into
Conversation
The backend labels the first week bucket of a period that starts mid-week with the period start date (Plausible.Stats.Time.date_or_weekstart/2), but annotations were always grouped by start of week, so annotations in that partial first week never matched a graph bucket and were not shown. Group them under the first time label instead.
|
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
With the week interval, annotations in the first week of a period that starts mid-week are not shown on the main graph.
The backend labels that first, partial week bucket with the period start date (
Plausible.Stats.Time.date_or_weekstart/2, e.g. a period from Sun 2020-12-20 gets the labels2020-12-20, 2020-12-21, 2020-12-28, ...).getAnnotationDatetimeGroupalways grouped annotations by start of week (2020-12-14), andMainGraphlooks annotations up by the exact time label, so nothing matched that bucket.Repro: pick "Month" for December 2026 (starts on a Tuesday) or "Last 28 days", switch the graph to "Week", and add an annotation on a day in the first bucket. The annotation is saved but no marker appears on the first bucket.
Fix:
groupAnnotationsByDatetime/getAnnotationDatetimeGrouptake an optional first time label; with the week interval, a date whose start of week falls before that label is grouped under it.MainGraphpassesdata.meta.time_labels[0]. Without the new argument the behaviour is unchanged.Run in
assets/:npm run test(37 suites, 584 tests pass; the new test fails before the fix with2020-12-14instead of2020-12-20),npm run typecheck,npm run lint,npm run check-format.This PR was prepared with AI assistance (Claude).
Tests
Changelog
Documentation
Dark mode