Explorar el Código

Filter out missing CGM readings from TIR (> 30 minutes)

(cherry picked from commit fada6927121c1b07eb07572858f2e1046e3069ad)
Jon Mårtensson hace 3 años
padre
commit
ab7eddae85
Se han modificado 1 ficheros con 3 adiciones y 2 borrados
  1. 3 2
      FreeAPS/Sources/APS/APSManager.swift

+ 3 - 2
FreeAPS/Sources/APS/APSManager.swift

@@ -1258,9 +1258,10 @@ final class BaseAPSManager: APSManager, Injectable {
                     lastIndex = true
                 }
                 if array[i].bg_ < Double(hypoLimit), !lastIndex {
-                    timeInHypo += (currentTime - previousTime).timeInterval
+                    // Exclude duration between CGM readings which are more than 30 minutes
+                    timeInHypo += min((currentTime - previousTime).timeInterval, 30.minutes.timeInterval)
                 } else if array[i].bg_ >= Double(hyperLimit), !lastIndex {
-                    timeInHyper += (currentTime - previousTime).timeInterval
+                    timeInHyper += min((currentTime - previousTime).timeInterval, 30.minutes.timeInterval)
                 }
             }
             if timeInHypo == 0.0 {