Procházet zdrojové kódy

Fix display of forecast curves for mmol/L display

Deniz Cengiz před 1 rokem
rodič
revize
e86343e40f

+ 3 - 1
FreeAPS/Sources/Modules/Home/View/Chart/MainChartView.swift

@@ -521,10 +521,12 @@ extension MainChartView {
         ForEach(state.preprocessedData, id: \.id) { tuple in
             let forecastValue = tuple.forecastValue
             let forecast = tuple.forecast
+            let valueAsDecimal = Decimal(forecastValue.value)
+            let displayValue = units == .mmolL ? valueAsDecimal.asMmolL : valueAsDecimal
 
             LineMark(
                 x: .value("Time", timeForIndex(forecastValue.index)),
-                y: .value("Value", Int(forecastValue.value))
+                y: .value("Value", displayValue)
             )
             .foregroundStyle(by: .value("Predictions", forecast.type ?? ""))
         }