Skip to content

Add Future Carbs Alert#571

Open
bjorkert wants to merge 5 commits intodevfrom
feature/future-carbs-alert
Open

Add Future Carbs Alert#571
bjorkert wants to merge 5 commits intodevfrom
feature/future-carbs-alert

Conversation

@bjorkert
Copy link
Contributor

@bjorkert bjorkert commented Mar 22, 2026

Summary

  • Add a new alarm type that fires once when a future-dated carb entry's scheduled time arrives, reminding the user to start eating
  • Fix Nightscout treatment download query excluding future-dated entries
  • Default the alarm to acknowledge mode since it self-silences when the carb is no longer in the future
  • Add 10 unit tests for FutureCarbsCondition covering tracking, firing, deletion, lookahead bounds, min grams, stale cleanup, multi-carb behavior, and duplicate prevention

Notify when a future-dated carb entry's scheduled time arrives, serving
as a reminder to start eating in pre-bolus scenarios. Tracks future carb
entries across alarm ticks using persistent storage, with configurable
max lookahead window (default 45 min) to filter out fat/protein entries
and minimum carb threshold (default 5g).
10 test cases covering tracking, firing, deletion, lookahead bounds,
min grams filter, past carbs, stale cleanup, multi-carb per-tick
behavior, and duplicate prevention. Also fix Tests target missing
FRAMEWORK_SEARCH_PATHS for CocoaPods dependencies and add missing
latestPumpBattery field in withBattery test helper.
Trio sets created_at to the scheduled future time, but the Nightscout
query had an upper bound of "now", excluding any future-dated entries.
Extend the query window by predictionToLoad minutes so treatments
within the graph lookahead are fetched. Also add addingMinutes
parameter to getDateTimeString for precise minute-level offsets.
@bjorkert bjorkert self-assigned this Mar 22, 2026
Replace the prediction-based lookahead with a fixed 6-hour window and
rename currentTimeString to endTimeString for clarity.
@marionbarker
Copy link
Collaborator

Test

I did a quick test and it worked. I have not had time for code review.

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.

Feature request: notification for arrival of carbs entered as future carbs

2 participants