Skip to content

Share the horizon arithmetic and harden the look-ahead tests - #2

Open
bjorkert wants to merge 1 commit into
hamDiabetes:fix/predictive-lookahead-horizonfrom
loopandlearn:fix/pr-732-followups
Open

Share the horizon arithmetic and harden the look-ahead tests#2
bjorkert wants to merge 1 commit into
hamDiabetes:fix/predictive-lookahead-horizonfrom
loopandlearn:fix/pr-732-followups

Conversation

@bjorkert

Copy link
Copy Markdown

Follow-ups from a second review pass on loopandlearn#732. This targets the PR branch, so merging it here folds the changes into that PR.

  • LowBGCondition owns the horizon arithmetic: forecastPoints(forMinutes:) converts a look-ahead in minutes into a point count, and maxPredictiveMinutes is the longest look-ahead the alarm editor offers. Both alarmForecastPointCap and the editor's Predictive stepper range derive from these, keeping the formula, the cap, and the UI bound in step.
  • trioShortForecastKeepsHorizon keeps every combined point before index 5 above the threshold (IOB at index 4 is 82), so its assertion holds only when the 25-minute look-ahead reaches the full horizon.
  • loopSinglePointForecast pins both sides of the index-0-is-current-value convention: a lone high point stays silent and a lone low point fires.

LowBGCondition owns the horizon arithmetic: forecastPoints(forMinutes:)
converts a look-ahead in minutes into a point count, and
maxPredictiveMinutes is the longest look-ahead the alarm editor offers.
Both alarmForecastPointCap and the editor's Predictive stepper range
derive from these, keeping the formula, the cap, and the UI bound in
step.

trioShortForecastKeepsHorizon keeps every combined point before index 5
above the threshold, so its assertion holds only when the 25-minute
look-ahead reaches the full horizon. loopSinglePointForecast pins both
sides of the current-value convention: a lone high point stays silent
and a lone low point fires.
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