Prevent Failed requirement

This commit is contained in:
Milos Kozak 2022-01-06 12:11:53 +01:00
parent 51a42e5784
commit 3a30f73aa1
2 changed files with 2 additions and 3 deletions

View file

@ -3,12 +3,10 @@ package info.nightscout.androidaps.dependencyInjection
import dagger.Module
import dagger.android.ContributesAndroidInjector
import info.nightscout.androidaps.plugins.aps.logger.LoggerCallback
import info.nightscout.androidaps.plugins.aps.loop.APSResult
import info.nightscout.androidaps.plugins.aps.openAPSAMA.DetermineBasalAdapterAMAJS
import info.nightscout.androidaps.plugins.aps.openAPSAMA.DetermineBasalResultAMA
import info.nightscout.androidaps.plugins.aps.openAPSSMB.DetermineBasalAdapterSMBJS
import info.nightscout.androidaps.plugins.aps.openAPSSMB.DetermineBasalResultSMB
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.data.AutosensData
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobOref1Thread
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobThread

View file

@ -15,7 +15,8 @@ class SyncPumpCancelTemporaryBasalIfAnyTransaction(
return result
val current = database.temporaryBasalDao.getTemporaryBasalActiveAt(timestamp, pumpType, pumpSerial).blockingGet()
if (current != null && current.interfaceIDs.endId == null) { // do not allow overwrite if cut by end event
current.end = timestamp
if (current.timestamp != timestamp) current.end = timestamp // prevent zero duration
else current.duration = 1
current.interfaceIDs.endId = endPumpId
database.temporaryBasalDao.updateExistingEntry(current)
result.updated.add(current)