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

Merge pull request #550 from nightscout/fix-meal-zombie-carb-logic

Fixes zombie carb detection in oref swift meal
Sam King 10 месяцев назад
Родитель
Сommit
95308675ed
1 измененных файлов с 5 добавлено и 2 удалено
  1. 5 2
      Trio/Sources/APS/OpenAPSSwift/Meal/MealTotal.swift

+ 5 - 2
Trio/Sources/APS/OpenAPSSwift/Meal/MealTotal.swift

@@ -157,8 +157,11 @@ enum MealTotal {
             carbImpactDate: cobInputs.carbImpactDate
         )
 
-        // if currentDeviation is null or maxDeviation is 0, set mealCOB to 0 for zombie-carb safety
-        if finalCobResult.maxDeviation == 0 || finalCobResult.allDeviations.isEmpty {
+        // the comment in JS says this:
+        //    if currentDeviation is null or maxDeviation is 0, set mealCOB to 0
+        //    for zombie-carb safety
+        // But the code only checks if it's defined, not the value
+        if finalCobResult.allDeviations.isEmpty {
             mealCOB = 0
         }