Merge pull request #2647 from dv1/combov2-fixes-001
combov2: Set the bolusDelivered value when a bolus delivery is finished
This commit is contained in:
commit
bf97c405d7
|
@ -1102,7 +1102,17 @@ class ComboV2Plugin @Inject constructor (
|
|||
reportFinishedBolus(R.string.combov2_bolus_delivery_failed, pumpEnactResult, succeeded = false)
|
||||
} finally {
|
||||
// The delivery was enacted if even a partial amount was infused.
|
||||
pumpEnactResult.enacted = acquiredPump.lastBolusFlow.value?.let { it.bolusAmount > 0 } ?: false
|
||||
acquiredPump.lastBolusFlow.value?.also {
|
||||
pumpEnactResult.enacted = (it.bolusAmount > 0)
|
||||
pumpEnactResult.bolusDelivered = it.bolusAmount.cctlBolusToIU()
|
||||
} ?: run {
|
||||
pumpEnactResult.enacted = false
|
||||
pumpEnactResult.bolusDelivered = 0.0
|
||||
}
|
||||
aapsLogger.debug(
|
||||
LTag.PUMP,
|
||||
"Pump enact result: success ${pumpEnactResult.success} enacted ${pumpEnactResult.enacted} bolusDelivered ${pumpEnactResult.bolusDelivered}"
|
||||
)
|
||||
bolusJob = null
|
||||
bolusProgressJob.cancelAndJoin()
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue