Skip to content

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

Merged
marionbarker merged 11 commits into
loopandlearn:devfrom
kristinkand:feature/stats-period
Oct 26, 2026
Merged

marionbarker merged 11 commits into
loopandlearn:devfrom
kristinkand:feature/stats-period

Conversation

@kristinkand

Copy link
Copy Markdown
Contributor

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.
kristinkand and others added 2 commits October 10, 2026 20:33
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.
Very low and very high cutoffs come from one place, so the calculator,
the home screen band and the Stats legend agree when a custom range
reaches past 54 or 250 mg/dL. Legend rows for low and high bands with no
width are hidden.
bjorkert
bjorkert previously approved these changes Oct 11, 2026
@bjorkert bjorkert linked an issue Oct 11, 2026 that may be closed by this pull request
# Conflicts:
#	LoopFollow/ViewControllers/MainViewController.swift
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LgnnHLJbhxmQaEjQNYR5VZ

@marionbarker marionbarker left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve by test

@marionbarker
marionbarker merged commit 20ad482 into loopandlearn:dev Oct 26, 2026
1 check passed
snickerdoodleparent pushed a commit to snickerdoodle-co/LoopFollow that referenced this pull request Nov 4, 2026
Brings in the Apple Watch app (loopandlearn#785), the end alarms' early warning (loopandlearn#721), the home
screen TIR band with its shared period (loopandlearn#774), the range thresholds in one place with
Extended Tight Range / TING 63–140 mg/dL (loopandlearn#791), the DST fix for the stats day loops
(loopandlearn#795) and the fixes for explicit-null Nightscout fields (loopandlearn#797).

Kept from this branch: the dynamic glucose colors (TIR band, graph, Live Activity) with
the Target setting, the Weekend Profile overrides and remote commands, the BFU check
before alarms, the TIR band shown by default.

The older watch app (LoopFollowWatch Watch App, the phone's WatchComplication and
WatchConnectivityManager) gives way to loopandlearn#785's. The Weekend Profile commands use
ReturnNotificationInfo.loopFollow(), as loopandlearn#785 moved the helper.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UUzqfqfsM8BQYJ2yoRaLz8
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.

Request for an option to start Statistics at 00:00

3 participants