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

Refactor iAPS eventual BG display for user preferences

Jonas Björkert 2 лет назад
Родитель
Сommit
ad5e73e7f9
1 измененных файлов с 4 добавлено и 1 удалено
  1. 4 1
      LoopFollow/Controllers/NightScout.swift

+ 4 - 1
LoopFollow/Controllers/NightScout.swift

@@ -702,7 +702,10 @@ extension MainViewController {
                             let graphdata = predbgdata[graphtype] as! [Double]
                             
                             if let eventualdata = lastLoopRecord["enacted"] as? [String:AnyObject] {
-                                PredictionLabel.text = String(format:"%.0f", eventualdata["eventualBG"] as! Double)
+                                if let eventualBGValue = eventualdata["eventualBG"] as? NSNumber {
+                                    let eventualBGStringValue = String(describing: eventualBGValue)
+                                    PredictionLabel.text = bgUnits.toDisplayUnits(eventualBGStringValue)
+                                }
                             }
                             
                             if UserDefaultsRepository.downloadPrediction.value && latestLoopTime < lastLoopTime {