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

Filter out all IoB replays when the pump is currently suspended

Sam King 5 месяцев назад
Родитель
Сommit
f9d34459e7
1 измененных файлов с 4 добавлено и 2 удалено
  1. 4 2
      TrioTests/OpenAPSSwiftTests/IobJsonTests.swift

+ 4 - 2
TrioTests/OpenAPSSwiftTests/IobJsonTests.swift

@@ -65,8 +65,10 @@ import Testing
             // The JS implementation of IoB when the pump is suspend is so fundamentally
             // broken that I wasn't able to fix it in JS. So we'll just skip these, but I
             // verified them by hand and the Swift implementation appears to be correct
-            if let mostRecentPumpEvent = iobInputs.history.filter({ $0.isExternal != true }).first {
-                if mostRecentPumpEvent.type == .pumpSuspend
+            if let mostRecentSuspendResumeEvent = iobInputs.history.filter({ $0.type == .pumpSuspend || $0.type == .pumpResume })
+                .first
+            {
+                if mostRecentSuspendResumeEvent.type == .pumpSuspend
                 {
                     print("Skipping, known issue with JS and currently suspended pumps")
                     continue