Skip to content

Commit 35090a0

Browse files
authored
Fix order of pump events delivered to NightscoutUploadKit (#147)
TempBasal and TempBasalDuration must appear in the same order as in the pump
1 parent 3573ed9 commit 35090a0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Loop/Managers/DeviceDataManager.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -842,7 +842,8 @@ final class DeviceDataManager: CarbStoreDelegate, DoseStoreDelegate, Transmitter
842842
var objectIDs = [NSManagedObjectID]()
843843
var timestampedPumpEvents = [TimestampedHistoryEvent]()
844844

845-
for event in pumpEvents {
845+
// TODO: LoopKit should return these in chronological order instead of reversing here.
846+
for event in pumpEvents.reverse() {
846847
objectIDs.append(event.objectID)
847848

848849
if let raw = event.raw where raw.length > 0, let type = MinimedKit.PumpEventType(rawValue: raw[0])?.eventType, pumpEvent = type.init(availableData: raw, pumpModel: pumpModel) {

0 commit comments

Comments
 (0)