combov2: Set the bolusDelivered value when a bolus delivery is finished
Fixes https://github.com/nightscout/AndroidAPS/issues/2594
This commit is contained in:
parent
1500381e14
commit
d85fd9e8fe
1 changed files with 11 additions and 1 deletions
|
@ -1102,7 +1102,17 @@ class ComboV2Plugin @Inject constructor (
|
||||||
reportFinishedBolus(R.string.combov2_bolus_delivery_failed, pumpEnactResult, succeeded = false)
|
reportFinishedBolus(R.string.combov2_bolus_delivery_failed, pumpEnactResult, succeeded = false)
|
||||||
} finally {
|
} finally {
|
||||||
// The delivery was enacted if even a partial amount was infused.
|
// 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
|
bolusJob = null
|
||||||
bolusProgressJob.cancelAndJoin()
|
bolusProgressJob.cancelAndJoin()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue