Skip to content

Commit a8fa3eb

Browse files
committed
Fixed dynamic carb value unit error
1 parent 4a5e94a commit a8fa3eb

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

Sources/LoopAlgorithmToPython/LoopAlgorithmToPython.swift

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -418,9 +418,17 @@ public func getDynamicCarbsOnBoard(jsonData: UnsafePointer<Int8>?) -> Double {
418418

419419
let startDate = dateFormatter.date(from: input.inputICE[0].startAt)!
420420
let endDate = dateFormatter.date(from: input.inputICE.last!.startAt)!
421-
let carbRatio = [AbsoluteScheduleValue(startDate: startDate, endDate: endDate, value: input.carbRatio)]
422-
let isf = [AbsoluteScheduleValue(startDate: startDate, endDate: endDate, value: LoopQuantity(unit: LoopUnit(from: "mg/dL"), doubleValue: input.sensitivity))]
421+
let carbRatio = [AbsoluteScheduleValue(
422+
startDate: startDate,
423+
endDate: endDate,
424+
value: LoopQuantity(unit: LoopUnit(from: "g/U"), doubleValue: input.carbRatio)
425+
)]
423426

427+
let isf = [AbsoluteScheduleValue(
428+
startDate: startDate,
429+
endDate: endDate,
430+
value: LoopQuantity(unit: LoopUnit(from: "mg/dL/U"), doubleValue: input.sensitivity)
431+
)]
424432
let statuses = [carbEntries[0]].map(
425433
to: inputICE,
426434
carbRatio: carbRatio,

0 commit comments

Comments
 (0)