combov2: Set the bolusDelivered value when a bolus delivery is finished

Fixes https://github.com/nightscout/AndroidAPS/issues/2594
This commit is contained in:
Carlos Rafael Giani 2023-08-03 14:58:13 +02:00
parent 1500381e14
commit d85fd9e8fe

View file

@ -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()
} }