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,6 +890,10 @@ class MedtronicHistoryData @Inject constructor(
"pumpId=${tempBasalProcess.itemOne.pumpId}, " + "pumpId=${tempBasalProcess.itemOne.pumpId}, " +
"pumpSerial=${medtronicPumpStatus.serialNumber}]") "pumpSerial=${medtronicPumpStatus.serialNumber}]")
if (tempBasalProcess.durationAsSeconds <= 0) {
rxBus.send(EventNewNotification(Notification(Notification.MDT_INVALID_HISTORY_DATA, rh.gs(R.string.invalid_history_data), Notification.URGENT)))
aapsLogger.debug(LTag.PUMP, "syncTemporaryBasalWithPumpId - Skipped")
} else {
val result = pumpSync.syncTemporaryBasalWithPumpId( val result = pumpSync.syncTemporaryBasalWithPumpId(
tryToGetByLocalTime(tempBasalProcess.itemOne.atechDateTime), tryToGetByLocalTime(tempBasalProcess.itemOne.atechDateTime),
0.0, 0.0,
@ -897,11 +902,13 @@ class MedtronicHistoryData @Inject constructor(
PumpSync.TemporaryBasalType.PUMP_SUSPEND, PumpSync.TemporaryBasalType.PUMP_SUSPEND,
tempBasalProcess.itemOne.pumpId, tempBasalProcess.itemOne.pumpId,
medtronicPumpStatus.pumpType, medtronicPumpStatus.pumpType,
medtronicPumpStatus.serialNumber) medtronicPumpStatus.serialNumber
)
aapsLogger.debug(LTag.PUMP, "syncTemporaryBasalWithPumpId: Result: $result") aapsLogger.debug(LTag.PUMP, "syncTemporaryBasalWithPumpId: Result: $result")
} }
} }
}
// suspend/resume // suspend/resume
// no_delivery/prime & rewind/prime // no_delivery/prime & rewind/prime