check that deliveredBolus amount is positive
This commit is contained in:
parent
3a2ac68a6f
commit
0853e98de6
1 changed files with 6 additions and 0 deletions
|
@ -731,6 +731,8 @@ class OmnipodDashPumpPlugin @Inject constructor(
|
||||||
requestedBolusAmount: Double,
|
requestedBolusAmount: Double,
|
||||||
bolusType: DetailedBolusInfo.BolusType
|
bolusType: DetailedBolusInfo.BolusType
|
||||||
): Boolean {
|
): Boolean {
|
||||||
|
require(requestedBolusAmount > 0) {"requestedBolusAmount has to be positive"}
|
||||||
|
|
||||||
val activeCommand = podStateManager.activeCommand
|
val activeCommand = podStateManager.activeCommand
|
||||||
if (activeCommand == null) {
|
if (activeCommand == null) {
|
||||||
throw IllegalArgumentException(
|
throw IllegalArgumentException(
|
||||||
|
@ -1356,6 +1358,10 @@ class OmnipodDashPumpPlugin @Inject constructor(
|
||||||
if (confirmation.success) {
|
if (confirmation.success) {
|
||||||
podStateManager.lastBolus?.run {
|
podStateManager.lastBolus?.run {
|
||||||
val deliveredUnits = markComplete()
|
val deliveredUnits = markComplete()
|
||||||
|
if (deliveredUnits < 0){
|
||||||
|
aapsLogger.error(LTag.PUMP, "Negative delivered units!!! $deliveredUnits")
|
||||||
|
return
|
||||||
|
}
|
||||||
val bolusHistoryEntry = history.getById(historyId)
|
val bolusHistoryEntry = history.getById(historyId)
|
||||||
val sync = pumpSync.syncBolusWithPumpId(
|
val sync = pumpSync.syncBolusWithPumpId(
|
||||||
timestamp = bolusHistoryEntry.createdAt,
|
timestamp = bolusHistoryEntry.createdAt,
|
||||||
|
|
Loading…
Reference in a new issue