fix interval cutting during pump sync

This commit is contained in:
Milos Kozak 2021-10-21 16:00:26 +02:00
parent 7ed9616df3
commit d520c45aba
2 changed files with 2 additions and 0 deletions

View file

@ -32,6 +32,7 @@ class SyncPumpExtendedBolusTransaction(private val extendedBolus: ExtendedBolus)
val pctRun = (extendedBolus.timestamp - running.timestamp) / running.duration.toDouble()
running.amount /= pctRun
running.end = extendedBolus.timestamp
running.interfaceIDs.endId = extendedBolus.interfaceIDs.pumpId
database.extendedBolusDao.updateExistingEntry(running)
result.updated.add(running)
}

View file

@ -35,6 +35,7 @@ class SyncPumpTemporaryBasalTransaction(
val running = database.temporaryBasalDao.getTemporaryBasalActiveAt(temporaryBasal.timestamp, temporaryBasal.interfaceIDs.pumpType!!, temporaryBasal.interfaceIDs.pumpSerial!!).blockingGet()
if (running != null) {
running.end = temporaryBasal.timestamp
running.interfaceIDs.endId = temporaryBasal.interfaceIDs.pumpId
database.temporaryBasalDao.updateExistingEntry(running)
result.updated.add(running)
}