瀏覽代碼

Use the events own timestamp to dedup in PumpHistoryStorage

Marvin Polscheit 3 天之前
父節點
當前提交
7ab520cc3a
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      Trio/Sources/APS/Storage/PumpHistoryStorage.swift

+ 2 - 2
Trio/Sources/APS/Storage/PumpHistoryStorage.swift

@@ -101,8 +101,8 @@ final class BasePumpHistoryStorage: PumpHistoryStorage, Injectable {
                         dose.unitsInDeliverableIncrements,
                         toIncrement: Double(self.settings.preferences.bolusIncrement)
                     )
-                    // restrict entry to now or past
-                    let timestamp = event.date > Date() ? Date() : event.date
+                    // Use the event's own timestamp to dedup
+                    let timestamp = event.date
                     let key = dedupKey(timestamp: timestamp, type: PumpEvent.bolus.rawValue)
 
                     if let existingEvent = existingByKey[key] {