Просмотр исходного кода

Change default dia check to >= 5

Sam King 1 год назад
Родитель
Сommit
795eb0c4d4

+ 4 - 3
FreeAPS/Sources/APS/OpenAPSSwift/Profile/ProfileGenerator.swift

@@ -127,11 +127,12 @@ enum ProfileGenerator {
         // where it checks the input for properties that match the defaults
         profile.update(from: preferences)
 
-        if pumpSettings.insulinActionCurve > 1 {
-            profile.dia = pumpSettings.insulinActionCurve
-        } else {
+        // in the Javascript version this check is for 1, but in Trio
+        // the minimum dia you can set with the UI is 5
+        guard pumpSettings.insulinActionCurve >= 5 else {
             throw ProfileError.invalidDIA(value: pumpSettings.insulinActionCurve)
         }
+        profile.dia = pumpSettings.insulinActionCurve
 
         profile.model = model
         profile.skipNeutralTemps = preferences.skipNeutralTemps

+ 5 - 5
FreeAPSTests/OpenAPSSwiftTests/ProfileJavascriptTests.swift

@@ -16,7 +16,7 @@ struct ProfileGeneratorTests {
         FreeAPSSettings
     ) {
         let pumpSettings = PumpSettings(
-            insulinActionCurve: 3,
+            insulinActionCurve: 10,
             maxBolus: 10,
             maxBasal: 2
         )
@@ -73,7 +73,7 @@ struct ProfileGeneratorTests {
         )
 
         #expect(profile.maxIob == 0)
-        #expect(profile.dia == 3)
+        #expect(profile.dia == 10)
         #expect(profile.sens == 100)
         #expect(profile.currentBasal == 1)
         #expect(profile.maxBg == 100)
@@ -116,7 +116,7 @@ struct ProfileGeneratorTests {
         )
 
         #expect(profile.maxIob == 0)
-        #expect(profile.dia == 3)
+        #expect(profile.dia == 10)
         #expect(profile.sens == 100)
         #expect(profile.currentBasal == 1)
         #expect(profile.maxBg == 80)
@@ -160,7 +160,7 @@ struct ProfileGeneratorTests {
         )
 
         #expect(profile.maxIob == 0)
-        #expect(profile.dia == 3)
+        #expect(profile.dia == 10)
         #expect(profile.sens == 100)
         #expect(profile.currentBasal == 1)
         #expect(profile.maxBg == 100)
@@ -203,7 +203,7 @@ struct ProfileGeneratorTests {
         )
 
         #expect(profile.maxIob == 0)
-        #expect(profile.dia == 3)
+        #expect(profile.dia == 10)
         #expect(profile.sens == 100)
         #expect(profile.currentBasal == 1)
         #expect(profile.maxBg == 100)

+ 1 - 1
FreeAPSTests/OpenAPSSwiftTests/ProfileJsNativeCompareTests.swift

@@ -16,7 +16,7 @@ import Testing
         FreeAPSSettings
     ) {
         let pumpSettings = PumpSettings(
-            insulinActionCurve: 3,
+            insulinActionCurve: 10,
             maxBolus: 10,
             maxBasal: 2
         )