Skip to content

Home screen stats: TIR band and shared period (last 24 h or since midnight) - #774

Open
kristinkand wants to merge 8 commits into
loopandlearn:devfrom
kristinkand:feature/stats-period
Open

kristinkand wants to merge 8 commits into
loopandlearn:devfrom
kristinkand:feature/stats-period

Conversation

@kristinkand

Copy link
Copy Markdown

Closes #331
Supersedes #766 (includes its Time in Range band, rebased on the current dev, with the fixes from kristinkand#57)

With this PR the Time in Range band and the statistics box use the same time period. The user decides whether to show the statistics box or the band, and whether it covers the last 24 hours or today since midnight.

The choices are made under Settings > General > Statistics:

  • Stats Style lets you choose between the Time in Range Band and the Statistics Box.
  • Stats Period lets you choose between Last 24 Hours (default) and Today (since midnight).

The range follows the Range Mode set under Settings > Units and Metrics.

kristinkand and others added 4 commits October 10, 2026 17:15
The band now uses TIRCalculator, so each reading is counted once with
the same 54 and 250 mg/dL cutoffs as the TIR chart in Stats. It also
has a very high segment and uses the same colors as that chart. Every
non-empty segment gets a minimum width so a single low reading stays
visible, and the bar fills the full width of the band. The Stats Style
setting is only in General.
…e midnight)

Use the same period for statistics box and TIR band (last 24h or since midnight)
Very low is below the lower of 54 mg/dL and the range's low bound, and very high is above the higher of 250 mg/dL and the range's high bound. In range in the TIR band and the Stats screen then matches the statistics box for any custom range.
TIR band: custom range bounds, threshold refresh, shared title

Great catch!
#57 fixed the double counting: since then, every reading lands in exactly one segment.
#58 fixes which segment it lands in. With a custom low limit below 3.0 mmol/L, a reading between that limit and 3.0 is in your range, so it shouldn’t count as “very low”. Before #58, the band and the statistics box could therefore show different in-range percentages for such custom ranges. Now they match.

This only matters with a custom range that reaches below 3.0 or above 13.9 mmol/L. With TIR, TITR or TING nothing changes, because those ranges never go past those limits.
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.

2 participants