From e80718ef30e0707573e4e87ccfdc72785587d90b Mon Sep 17 00:00:00 2001 From: Liroy van Hoewijk <4643445+LiroyvH@users.noreply.github.com> Date: Fri, 27 Oct 2023 17:55:50 +0200 Subject: [PATCH] Prevent Nightscout collisions from occurring when a transmitter ID is recycled (#285) * Update DexcomSourceG5.swift Generate unique _id value to prevent Mongo collisions in Nightscout * Update DexcomSourceG6.swift Generate unique _id value to prevent Mongo collisions in Nightscout --- FreeAPS/Sources/APS/CGM/DexcomSourceG5.swift | 2 +- FreeAPS/Sources/APS/CGM/DexcomSourceG6.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/FreeAPS/Sources/APS/CGM/DexcomSourceG5.swift b/FreeAPS/Sources/APS/CGM/DexcomSourceG5.swift index 847e462da7..831dfd2a5a 100644 --- a/FreeAPS/Sources/APS/CGM/DexcomSourceG5.swift +++ b/FreeAPS/Sources/APS/CGM/DexcomSourceG5.swift @@ -148,7 +148,7 @@ extension DexcomSourceG5: CGMManagerDelegate { let quantity = newGlucoseSample.quantity let value = Int(quantity.doubleValue(for: .milligramsPerDeciliter)) return BloodGlucose( - _id: newGlucoseSample.syncIdentifier, + _id: UUID().uuidString, sgv: value, direction: .init(trendType: newGlucoseSample.trend), date: Decimal(Int(newGlucoseSample.date.timeIntervalSince1970 * 1000)), diff --git a/FreeAPS/Sources/APS/CGM/DexcomSourceG6.swift b/FreeAPS/Sources/APS/CGM/DexcomSourceG6.swift index b5f00d381e..ad5a3afeec 100644 --- a/FreeAPS/Sources/APS/CGM/DexcomSourceG6.swift +++ b/FreeAPS/Sources/APS/CGM/DexcomSourceG6.swift @@ -153,7 +153,7 @@ extension DexcomSourceG6: CGMManagerDelegate { let quantity = newGlucoseSample.quantity let value = Int(quantity.doubleValue(for: .milligramsPerDeciliter)) return BloodGlucose( - _id: newGlucoseSample.syncIdentifier, + _id: UUID().uuidString, sgv: value, direction: .init(trendType: newGlucoseSample.trend), date: Decimal(Int(newGlucoseSample.date.timeIntervalSince1970 * 1000)),