|
|
@@ -388,6 +388,10 @@ extension Treatments {
|
|
|
// Use the cob value of the simulation if carbs are backdated, otherwise set `simulatedCOB` to nil so that the cob value of the most recent determination gets used in the Bolus Calc Manager
|
|
|
let simulatedCOB: Int16? = isBackdated ?
|
|
|
Int16(truncating: NSNumber(value: (simulatedDetermination?.cob as NSDecimalNumber?)?.doubleValue ?? 0)) : nil
|
|
|
+ // If the user backdates carbs the current carb value must be set to 0
|
|
|
+ // otherwise the calc would recommend insulin for carbs + backdated carbs
|
|
|
+ // e.g. you enter 50g carbs and backdate them 1h -> calc would recommend insulin for 50g + ~45g (where ~45g is the partially absorbed cob)
|
|
|
+ let carbs: Decimal = isBackdated ? 0 : self.carbs
|
|
|
|
|
|
let result = await bolusCalculationManager.handleBolusCalculation(
|
|
|
carbs: carbs,
|