MDT TBR fix

This commit is contained in:
Milos Kozak 2021-12-06 13:46:44 +01:00
parent a2c7f2a6d9
commit 0b102376c6

View file

@ -631,6 +631,11 @@ class MedtronicHistoryData @Inject constructor(
"pumpId=${tempBasalProcessDTO.pumpId}, pumpType=${medtronicPumpStatus.pumpType}, " +
"pumpSerial=${medtronicPumpStatus.serialNumber}]")
if (tempBasalProcessDTO.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.syncTemporaryBasalWithTempId(
tryToGetByLocalTime(tempBasalProcessDTO.atechDateTime),
tbrEntry.insulinRate,
@ -640,9 +645,11 @@ class MedtronicHistoryData @Inject constructor(
PumpSync.TemporaryBasalType.NORMAL,
tempBasalProcessDTO.pumpId,
medtronicPumpStatus.pumpType,
medtronicPumpStatus.serialNumber)
medtronicPumpStatus.serialNumber
)
aapsLogger.debug(LTag.PUMP, "syncTemporaryBasalWithTempId - Result: $result")
}
pumpSyncStorage.removeTemporaryBasalWithTemporaryId(entryWithTempId.temporaryId)
tbrRecords.remove(entryWithTempId)