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

More rounding, add a little comparison buffer

Sam King 10 месяцев назад
Родитель
Сommit
daf0e47cbe

+ 1 - 1
Trio/Sources/APS/OpenAPSSwift/DetermineBasal/DetermineBasal+Helpers.swift

@@ -115,7 +115,7 @@ extension DeterminationGenerator {
 
 
         let fiveMinuteBlocks = Decimal((2 * 60) / 5)
         let fiveMinuteBlocks = Decimal((2 * 60) / 5)
         let delta = targetGlucose - eventualGlucose
         let delta = targetGlucose - eventualGlucose
-        return (glucoseImpact + (delta / fiveMinuteBlocks)).rounded(toPlaces: 1)
+        return (glucoseImpact + (delta / fiveMinuteBlocks)).jsRounded(scale: 1)
     }
     }
 
 
     /// Determines whether SMBs are enabled based on profile settings,
     /// Determines whether SMBs are enabled based on profile settings,

+ 1 - 1
Trio/Sources/APS/OpenAPSSwift/DetermineBasal/DetermineBasalGenerator.swift

@@ -151,7 +151,7 @@ enum DeterminationGenerator {
             withZeroTemp: true
             withZeroTemp: true
         )
         )
 
 
-        guard let currentGlucoseImpact = glucoseImpactSeries.first?.rounded(scale: 2) else {
+        guard let currentGlucoseImpact = glucoseImpactSeries.first?.jsRounded(scale: 2) else {
             throw DeterminationError.determinationError
             throw DeterminationError.determinationError
         }
         }
 
 

+ 2 - 1
Trio/Sources/APS/OpenAPSSwift/Logging/OrefFunction.swift

@@ -116,7 +116,8 @@ enum OrefFunction: String, Codable {
             ]
             ]
         case .determineBasal:
         case .determineBasal:
             return [
             return [
-                "sensitivityRatio": 0.011 // consistent with Autosens
+                "sensitivityRatio": 0.011,
+                "expectedDelta": 0.11
             ]
             ]
         }
         }
     }
     }

+ 1 - 1
TrioTests/OpenAPSSwiftTests/DetermineBasalJsonTests.swift

@@ -103,7 +103,7 @@ import Testing
         // this test is meant for one-off analysis so it's ok to hard code
         // this test is meant for one-off analysis so it's ok to hard code
         // a file, just make sure to _not_ check in updates to this to
         // a file, just make sure to _not_ check in updates to this to
         // avoid polluting our change logs
         // avoid polluting our change logs
-        let algorithmComparison = try await HttpFiles.downloadFile(at: "/files/0341b91d-c75b-462b-b5a1-5aee9e973bc8.1.json")
+        let algorithmComparison = try await HttpFiles.downloadFile(at: "/files/9cd14347-cef1-4ff0-bb79-2ae45c440951.1.json")
         let determineBasalInput = algorithmComparison.determineBasalInput!
         let determineBasalInput = algorithmComparison.determineBasalInput!
 
 
         let encoder = JSONCoding.encoder
         let encoder = JSONCoding.encoder