Kaynağa Gözat

Add explicit logging for single bolus entries for TDD calc

Deniz Cengiz 1 yıl önce
ebeveyn
işleme
dd812b351c
1 değiştirilmiş dosya ile 6 ekleme ve 1 silme
  1. 6 1
      FreeAPS/Sources/APS/Storage/TDDStorage.swift

+ 6 - 1
FreeAPS/Sources/APS/Storage/TDDStorage.swift

@@ -151,7 +151,12 @@ final class BaseTDDStorage: TDDStorage, Injectable {
     private func calculateBolusInsulin(_ bolusEvents: [PumpHistoryEvent]) -> Decimal {
         bolusEvents
             .reduce(Decimal(0)) { totalBolusInsulin, event in
-                totalBolusInsulin + (event.amount ?? 0)
+                let newTotalBolusInsulin = totalBolusInsulin + (event.amount as Decimal? ?? 0)
+                debug(
+                    .apsManager,
+                    "Bolus insulin \(event.amount ?? 0) U added. New total bolus = \(newTotalBolusInsulin) U"
+                )
+                return newTotalBolusInsulin
             }
     }