MDT: fix history duration processing

This commit is contained in:
Milos Kozak 2022-03-28 11:35:08 +02:00
parent aeb0d0cf2d
commit 46a8bd5d6e

View file

@ -406,7 +406,8 @@ class MedtronicHistoryData @Inject constructor(
if (lastPrimeRecord != null) { if (lastPrimeRecord != null) {
uploadCareportalEventIfFoundInHistory(lastPrimeRecord, uploadCareportalEventIfFoundInHistory(lastPrimeRecord,
MedtronicConst.Statistics.LastPrime, MedtronicConst.Statistics.LastPrime,
DetailedBolusInfo.EventType.CANNULA_CHANGE) DetailedBolusInfo.EventType.CANNULA_CHANGE
)
} }
} }
@ -889,17 +890,23 @@ class MedtronicHistoryData @Inject constructor(
"pumpId=${tempBasalProcess.itemOne.pumpId}, " + "pumpId=${tempBasalProcess.itemOne.pumpId}, " +
"pumpSerial=${medtronicPumpStatus.serialNumber}]") "pumpSerial=${medtronicPumpStatus.serialNumber}]")
val result = pumpSync.syncTemporaryBasalWithPumpId( if (tempBasalProcess.durationAsSeconds <= 0) {
tryToGetByLocalTime(tempBasalProcess.itemOne.atechDateTime), rxBus.send(EventNewNotification(Notification(Notification.MDT_INVALID_HISTORY_DATA, rh.gs(R.string.invalid_history_data), Notification.URGENT)))
0.0, aapsLogger.debug(LTag.PUMP, "syncTemporaryBasalWithPumpId - Skipped")
tempBasalProcess.durationAsSeconds * 1000L, } else {
true, val result = pumpSync.syncTemporaryBasalWithPumpId(
PumpSync.TemporaryBasalType.PUMP_SUSPEND, tryToGetByLocalTime(tempBasalProcess.itemOne.atechDateTime),
tempBasalProcess.itemOne.pumpId, 0.0,
medtronicPumpStatus.pumpType, tempBasalProcess.durationAsSeconds * 1000L,
medtronicPumpStatus.serialNumber) true,
PumpSync.TemporaryBasalType.PUMP_SUSPEND,
tempBasalProcess.itemOne.pumpId,
medtronicPumpStatus.pumpType,
medtronicPumpStatus.serialNumber
)
aapsLogger.debug(LTag.PUMP, "syncTemporaryBasalWithPumpId: Result: $result") aapsLogger.debug(LTag.PUMP, "syncTemporaryBasalWithPumpId: Result: $result")
}
} }
} }