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) {
uploadCareportalEventIfFoundInHistory(lastPrimeRecord,
MedtronicConst.Statistics.LastPrime,
DetailedBolusInfo.EventType.CANNULA_CHANGE)
DetailedBolusInfo.EventType.CANNULA_CHANGE
)
}
}
@ -889,17 +890,23 @@ class MedtronicHistoryData @Inject constructor(
"pumpId=${tempBasalProcess.itemOne.pumpId}, " +
"pumpSerial=${medtronicPumpStatus.serialNumber}]")
val result = pumpSync.syncTemporaryBasalWithPumpId(
tryToGetByLocalTime(tempBasalProcess.itemOne.atechDateTime),
0.0,
tempBasalProcess.durationAsSeconds * 1000L,
true,
PumpSync.TemporaryBasalType.PUMP_SUSPEND,
tempBasalProcess.itemOne.pumpId,
medtronicPumpStatus.pumpType,
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(
tryToGetByLocalTime(tempBasalProcess.itemOne.atechDateTime),
0.0,
tempBasalProcess.durationAsSeconds * 1000L,
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")
}
}
}