Skip to content

Commit 8041eec

Browse files
committed
fix: fix finalized dose
1 parent d949f11 commit 8041eec

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

DanaKit/PumpManager/DanaKitPumpManager.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1134,12 +1134,12 @@ extension DanaKitPumpManager: PumpManager {
11341134
))
11351135
}
11361136

1137-
if state.tempBasalEndsAt > Date.now {
1137+
if let units = state.tempBasalUnits {
11381138
// Report cancelled temp basal
11391139
events.append(NewPumpEvent.tempBasal(
11401140
dose: DoseEntry.tempBasal(
1141-
absoluteUnit: unitsPerHour,
1142-
duration: duration,
1141+
absoluteUnit: units,
1142+
duration: 0, // Ignored
11431143
insulinType: state.insulinType,
11441144
startDate: state.basalDeliveryDate,
11451145
endDate: Date.now
@@ -1150,8 +1150,8 @@ extension DanaKitPumpManager: PumpManager {
11501150

11511151
state.basalDeliveryOrdinal = isTempBasal ? .tempBasal : .active
11521152
state.basalDeliveryDate = startDate
1153-
state.tempBasalUnits = unitsPerHour
1154-
state.tempBasalDuration = duration
1153+
state.tempBasalUnits = isTempBasal ? unitsPerHour : nil
1154+
state.tempBasalDuration = isTempBasal ? duration : nil
11551155
state.lastStatusDate = Date.now
11561156
notifyStateDidChange()
11571157

0 commit comments

Comments
 (0)