Преглед изворни кода

Fix display of forecast curves for mmol/L display

Deniz Cengiz пре 1 година
родитељ
комит
e86343e40f
1 измењених фајлова са 3 додато и 1 уклоњено
  1. 3 1
      FreeAPS/Sources/Modules/Home/View/Chart/MainChartView.swift

+ 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 ?? ""))
         }