Przeglądaj źródła

Display scheduled basal dots
UI bug fix for issue nr 60: https://github.com/Artificial-Pancreas/iAPS/issues/60

(cherry picked from commit ffecddaba70b6c2ed7494f4189a3269e03275119)

Jon Mårtensson 3 lat temu
rodzic
commit
551be37995

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

@@ -667,8 +667,9 @@ extension MainChartView {
                 path.addLine(to: CGPoint(x: lastPoint.x, y: Config.basalHeight))
                 path.addLine(to: CGPoint(x: 0, y: Config.basalHeight))
             }
-
-            let endDateTime = dayAgoTime + min(max(screenHours, 2), 24).hours.timeInterval + min(max(screenHours, 2), 24).hours
+            let adjustForOptionalExtraHours = screenHours > 12 ? screenHours - 12 : 0
+            let endDateTime = dayAgoTime + min(max(screenHours - adjustForOptionalExtraHours, 12), 24).hours
+                .timeInterval + min(max(screenHours - adjustForOptionalExtraHours, 12), 24).hours
                 .timeInterval
             let autotunedBasalPoints = findRegularBasalPoints(
                 timeBegin: dayAgoTime,