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

Add missing rounding for eventualGlucose

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

+ 2 - 2
Trio/Sources/APS/OpenAPSSwift/Forecasts/ForecastGenerator.swift

@@ -128,7 +128,7 @@ enum ForecastGenerator {
         if mealData.mealCOB > 0, carbImpact > 0 || carbImpactParams.remainingCarbImpactPeak > 0 {
             finalCobForecast = cobResult.forecasts
             if let lastCobGlucose = cobResult.forecasts.last {
-                eventualGlucose = max(eventualGlucose, lastCobGlucose)
+                eventualGlucose = max(eventualGlucose, lastCobGlucose.jsRounded())
             }
         }
 
@@ -136,7 +136,7 @@ enum ForecastGenerator {
         if profile.enableUAM, carbImpact > 0 || carbImpactParams.remainingCarbImpactPeak > 0 {
             finalUamForecast = uamResult.forecasts
             if let lastUamGlucose = uamResult.forecasts.last {
-                eventualGlucose = max(eventualGlucose, lastUamGlucose)
+                eventualGlucose = max(eventualGlucose, lastUamGlucose.jsRounded())
             }
         }
 

+ 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
         // a file, just make sure to _not_ check in updates to this to
         // avoid polluting our change logs
-        let algorithmComparison = try await HttpFiles.downloadFile(at: "/files/adf288fe-698e-43a1-bcdb-4c0355749c52.1.json")
+        let algorithmComparison = try await HttpFiles.downloadFile(at: "/files/ccb7fc85-b14b-46cd-83a3-958bdc5b0623.2.json")
         let determineBasalInput = algorithmComparison.determineBasalInput!
 
         let encoder = JSONCoding.encoder