Skip to content

Commit 687c055

Browse files
committed
CarbValue struct update
1 parent a5f44a2 commit 687c055

File tree

4 files changed

+3
-4
lines changed

4 files changed

+3
-4
lines changed

Loop/Extensions/DosingDecisionStore+SimulatedCoreData.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ fileprivate extension StoredDosingDecision {
147147
healthKitEligibleDate: nil)
148148
let carbsOnBoard = CarbValue(startDate: date,
149149
endDate: date.addingTimeInterval(.minutes(5)),
150-
quantity: HKQuantity(unit: .gram(), doubleValue: 45.5))
150+
value: 45.5)
151151
let insulinOnBoard = InsulinValue(startDate: date, value: 1.5)
152152
let glucoseTargetRangeSchedule = GlucoseRangeSchedule(rangeSchedule: DailyQuantitySchedule(unit: .milligramsPerDeciliter,
153153
dailyItems: [RepeatingScheduleValue(startTime: .hours(0), value: DoubleRange(minValue: 100.0, maxValue: 110.0)),

Loop/Managers/LoopDataManager.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1101,7 +1101,7 @@ extension LoopDataManager {
11011101
switch error {
11021102
case .noData:
11031103
// when there is no data, carbs on board is set to 0
1104-
self.carbsOnBoard = CarbValue(startDate: Date(), quantity: HKQuantity(unit: .gram(), doubleValue: 0))
1104+
self.carbsOnBoard = CarbValue(startDate: Date(), value: 0)
11051105
default:
11061106
self.carbsOnBoard = nil
11071107
warnings.append(.fetchDataWarning(.carbsOnBoard(error: error)))

LoopTests/Managers/LoopAlgorithmTests.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,5 +71,4 @@ final class LoopAlgorithmTests: XCTestCase {
7171
XCTAssertEqual(expected.quantity.doubleValue(for: .milligramsPerDeciliter), calculated.quantity.doubleValue(for: .milligramsPerDeciliter), accuracy: defaultAccuracy)
7272
}
7373
}
74-
7574
}

LoopTests/ViewModels/BolusEntryViewModelTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ class BolusEntryViewModelTests: XCTestCase {
283283
}
284284

285285
func testUpdateCarbsOnBoard() async throws {
286-
delegate.carbsOnBoardResult = .success(CarbValue(startDate: Self.exampleStartDate, endDate: Self.exampleEndDate, quantity: Self.exampleCarbQuantity))
286+
delegate.carbsOnBoardResult = .success(CarbValue(startDate: Self.exampleStartDate, endDate: Self.exampleEndDate, value: Self.exampleCarbQuantity.doubleValue(for: .gram())))
287287
XCTAssertNil(bolusEntryViewModel.activeCarbs)
288288
await bolusEntryViewModel.update()
289289
XCTAssertEqual(Self.exampleCarbQuantity, bolusEntryViewModel.activeCarbs)

0 commit comments

Comments
 (0)