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