Repository navigation
Conversation
…period Follow-up to realchendahuang#144: after the year view gained its own stats query anchored to the navigated year, two leftovers still leak the today-anchored 366-day window into historical periods. 1. Year view no longer falls back to stats.activity while the year query is loading. That array is anchored to today, so for a historical year it briefly painted the tail ~3 months with real data and everything else as zeroes - a misleading partial picture. An empty activity array renders a uniform "no records" colour until the request resolves. 2. Month view heat colors now come from the month-scoped hourly query (monthHourlyQuery, already used for day quadrants), aggregated into per-day totals. notesCountMap is built from the shared trailing-366-day stats and only covers the current window, so months older than that rendered all-zero; it stays as an in-flight fallback only. The hourly/counter reads scale with active hours in the requested range, not total memo count, so historical windows do not reintroduce the full scan cost from realchendahuang#142. Refs realchendahuang#144
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.
Summary
Follow-up to #144. The year-view anchor fix already landed upstream (cf95b82), but two leftovers still let the today-anchored trailing-366-day window leak into navigated historical periods.
Month view: zero heat colors for historical months
MonthHorizonPureViewcolors cells fromnotesCountMap, which is built from the sharedstats.activitytrailing-366-day window anchored to today.monthHourlyQueryalready fetches the exact navigated month (passed ashourlyData) but is only consumed for day quadrants. So navigating to any month outside the trailing window renders an all-zero heatmap, even though the correct monthly data is already in flight.This aggregates the month-scoped hourly rows into per-day totals and uses them as the heat source;
notesCountMapstays as an in-flight fallback only. The hourly reads still go throughmemo_hourly_countsand scale with active hours in the range, so this does not reintroduce the #142 full-scan cost.Year view: misleading fallback while loading a historical year
Since cf95b82 the year query falls back to the shared
stats.activitywhile loading. For a historical year that briefly paints the tail ~3 months with real data and everything else as zeroes — a flash of a misleading partial year. Falling back to[]renders a uniform "no records" colour until the year query resolves.The week-view data-source gap noted in #144 is intentionally not touched here (separate change line).
Verification
tsc --noEmit(apps/web) passesyearStatsQuery)Refs #144