Conversation
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.
Replace the prediction-based lookahead with a fixed 6-hour window and rename currentTimeString to endTimeString for clarity.
TestI did a quick test and it worked. I have not had time for code review. |
Code reviewLooks good TestPrevious test I entered carbs 15 minutes ahead and set the alarm. I got an alert which I acknowledged. This time, modify max look ahead to 10 minutes.
(One entry was direct on the phone. One was from a remote carb entry set 15 min in the future.) |
Carbs originally outside the lookahead window could drift into it over time and fire incorrectly. Now all future carbs are tracked from first observation, and only fire if their original distance (carbDate minus observedAt) was within the max lookahead. Stale cleanup also preserves entries whose carb still exists to prevent re-observation with a fresh timestamp.
|
Thanks for testing and catching this, code updated to avoid this issue. |
TestUpdated to commit 21e65f8. Repeat test of future carbs of 10 g in 15 min. Wait 15 minutes plus a few. ✅ I can see the future carbs in the LoopFollow plot More testing soon. |
Test✅ successful test Still using to commit 21e65f8. Set ignore future carbs > 15 minutes in future
Screenshot |
|
Thanks for the thorough testing! Regarding the carb amount not showing in the notification. All alarms share the same notification format: the title is the alarm name (which can be customized by the user), and the subtitle always shows the current BG, direction, and delta. Adding treatment-specific details would be a new pattern. We can revisit this if there's enough demand, but I suggest we keep it consistent for now. |
Summary
FutureCarbsConditioncovering tracking, firing, deletion, lookahead bounds, min grams, stale cleanup, multi-carb behavior, and duplicate prevention