|
|
@@ -610,9 +610,12 @@ final class BaseNightscoutManager: NightscoutManager, Injectable {
|
|
|
guard !glucose.isEmpty, let nightscout = nightscoutAPI, isUploadEnabled, isUploadGlucoseEnabled else {
|
|
|
return
|
|
|
}
|
|
|
+ // check if unique code
|
|
|
+ // var uuid = UUID(uuidString: yourString) This will return nil if yourString is not a valid UUID
|
|
|
+ let glucoseWithoutCorrectID = glucose.filter { UUID(uuidString: $0._id) != nil }
|
|
|
|
|
|
processQueue.async {
|
|
|
- glucose.chunks(ofCount: 100)
|
|
|
+ glucoseWithoutCorrectID.chunks(ofCount: 100)
|
|
|
.map { chunk -> AnyPublisher<Void, Error> in
|
|
|
nightscout.uploadGlucose(Array(chunk))
|
|
|
}
|