瀏覽代碼

on edits initial Step needs to be 1 mgdL / 0.1 mmolL

Robert 1 年之前
父節點
當前提交
176b042425

+ 2 - 2
FreeAPS/Sources/Modules/OverrideConfig/View/EditOverrideForm.swift

@@ -28,10 +28,10 @@ struct EditOverrideForm: View {
     @State private var hasChanges = false
     @State private var isEditing = false
     @State private var target_override = false
-    @State private var percentageStep: Int = 5
+    @State private var percentageStep: Int = 1
     @State private var displayPickerPercentage: Bool = false
     @State private var displayPickerDuration: Bool = false
-    @State private var targetStep: Decimal = 5
+    @State private var targetStep: Decimal = 1
     @State private var displayPickerTarget: Bool = false
     @State private var displayPickerDisableSmbSchedule: Bool = false
     @State private var displayPickerSmbMinutes: Bool = false

+ 20 - 20
FreeAPS/Sources/Modules/OverrideConfig/View/EditTempTargetForm.swift

@@ -11,7 +11,7 @@ struct EditTempTargetForm: View {
     @State private var tempTargetSensitivityAdjustmentType: TempTargetSensitivityAdjustmentType = .standard
     @State private var durationHours = 0
     @State private var durationMinutes = 0
-    @State private var targetStep: Decimal = 5
+    @State private var targetStep: Decimal = 1
     @State private var name: String
     @State private var target: Decimal
     @State private var duration: Decimal
@@ -60,25 +60,6 @@ struct EditTempTargetForm: View {
             )
     }
 
-    private var formatter: NumberFormatter {
-        let formatter = NumberFormatter()
-        formatter.numberStyle = .decimal
-        formatter.maximumFractionDigits = 0
-        return formatter
-    }
-
-    private var glucoseFormatter: NumberFormatter {
-        let formatter = NumberFormatter()
-        formatter.numberStyle = .decimal
-        if state.units == .mmolL {
-            formatter.maximumFractionDigits = 1
-        } else {
-            formatter.maximumFractionDigits = 0
-        }
-        formatter.roundingMode = .halfUp
-        return formatter
-    }
-
     var body: some View {
         NavigationView {
             List {
@@ -388,6 +369,25 @@ struct EditTempTargetForm: View {
         return max(0, durationTotal)
     }
 
+    private var formatter: NumberFormatter {
+        let formatter = NumberFormatter()
+        formatter.numberStyle = .decimal
+        formatter.maximumFractionDigits = 0
+        return formatter
+    }
+
+    private var glucoseFormatter: NumberFormatter {
+        let formatter = NumberFormatter()
+        formatter.numberStyle = .decimal
+        if state.units == .mmolL {
+            formatter.maximumFractionDigits = 1
+        } else {
+            formatter.maximumFractionDigits = 0
+        }
+        formatter.roundingMode = .halfUp
+        return formatter
+    }
+
     private func formattedPercentage(_ value: Double) -> String {
         let percentageNumber = NSNumber(value: value)
         return formatter.string(from: percentageNumber) ?? "\(value)"