Sfoglia il codice sorgente

modify artificial gap to 1 minute for overlapping overrides, add comments

marionbarker 1 anno fa
parent
commit
cdc9684a45

+ 2 - 2
LoopFollow/Controllers/Nightscout/Treatments/Overrides.swift

@@ -45,12 +45,12 @@ extension MainViewController {
                let nextStart   = NightscoutUtils.parseDate(nextDateStr)?
                 .timeIntervalSince1970
             {
-                end = min(end, nextStart - 300)
+                end = min(end, nextStart - 60) // avoid overlapping overrides
             }
 
             end = min(end, maxEndDate)
 
-            if end - start < 300 { continue }
+            if end - start < 300 { continue } // skip short overrides
 
             let dot = DataStructs.overrideStruct(
                 insulNeedsScaleFactor: e["insulinNeedsScaleFactor"] as? Double ?? 1,