Skip to content

Commit 184ea75

Browse files
authored
[LOOP-5558] rounding basal rates consistently (#885)
* rounding basal rates consistently * removing rounding basal rate loop quantity
1 parent 868a8a7 commit 184ea75

File tree

4 files changed

+3
-8
lines changed

4 files changed

+3
-8
lines changed

Loop/Managers/DeviceDataManager.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1343,10 +1343,6 @@ extension DeviceDataManager: DeliveryDelegate {
13431343

13441344
return pumpManager.roundToSupportedBasalRate(unitsPerHour: unitsPerHour)
13451345
}
1346-
1347-
func roundBasalRate(rate: LoopQuantity) -> LoopQuantity {
1348-
LoopQuantity(unit: .internationalUnitsPerHour, doubleValue: roundBasalRate(unitsPerHour: rate.doubleValue(for: .internationalUnitsPerHour)))
1349-
}
13501346

13511347
func roundBolusVolume(units: Double) -> Double {
13521348
guard let pumpManager = pumpManager else {

Loop/Managers/LoopDataManager.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ protocol DeliveryDelegate: AnyObject {
4747
func enact(bolus: Double?, tempBasal: TempBasalRecommendation?, decisionId: UUID?) async throws
4848
func enactBolus(units: Double, decisionId: UUID?, activationType: BolusActivationType) async throws
4949
func roundBasalRate(unitsPerHour: Double) -> Double
50-
func roundBasalRate(rate: LoopQuantity) -> LoopQuantity
5150
func roundBolusVolume(units: Double) -> Double
5251
}
5352

Loop/Views/Presets/Components/PresetDetentView.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ struct PresetDetentView: View {
2626
@Environment(\.appName) private var appName
2727

2828
let preset: SelectablePreset
29-
let roundBasalRate: ((LoopQuantity) -> LoopQuantity)?
29+
let roundBasalRate: ((Double) -> Double)?
3030
let didTapEdit: () -> Void
3131

3232
var operation: Operation? {
@@ -127,7 +127,7 @@ struct PresetDetentView: View {
127127
return settingsImpact
128128
}
129129

130-
settingsImpact.basalRate = roundBasalRate(basalRate)
130+
settingsImpact.basalRate = LoopQuantity(unit: .internationalUnitsPerHour, doubleValue: roundBasalRate(basalRate.doubleValue(for: .internationalUnitsPerHour)))
131131
return settingsImpact
132132
}
133133

Loop/Views/Presets/PresetsView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ struct PresetsView: View {
9292
settingsManager.therapySettings.glucoseTargetRangeSchedule?.quantityRange(at: Date())
9393
}
9494

95-
let roundBasalRate: ((LoopQuantity) -> LoopQuantity)?
95+
let roundBasalRate: ((Double) -> Double)?
9696

9797
var body: some View {
9898
NavigationStack(path: $navigationPath) {

0 commit comments

Comments
 (0)