CancelTbrCommand: set enacted=true, even when there was no TBR to cancel.
This helps recover when there was an issue. AAPS thinks there's a TBR running and by reporting back 'enacted', the plugin will create a "Cancel temp" treatment.
This commit is contained in:
parent
264e252300
commit
9674db8d85
|
@ -13,7 +13,11 @@ public class CancelTbrCommand implements Command {
|
||||||
Double tbrPercentage = (Double) scripter.currentMenu.getAttribute(MenuAttribute.TBR);
|
Double tbrPercentage = (Double) scripter.currentMenu.getAttribute(MenuAttribute.TBR);
|
||||||
boolean runtimeDisplayed = scripter.currentMenu.attributes().contains(MenuAttribute.RUNTIME);
|
boolean runtimeDisplayed = scripter.currentMenu.attributes().contains(MenuAttribute.RUNTIME);
|
||||||
if (tbrPercentage == 100 && !runtimeDisplayed) {
|
if (tbrPercentage == 100 && !runtimeDisplayed) {
|
||||||
return new CommandResult().success(true).enacted(false).message("No TBR active");
|
return new CommandResult()
|
||||||
|
.success(true)
|
||||||
|
.enacted(true) // technically, nothing was enacted, but AAPS needs this to recover
|
||||||
|
// when there was an issue and AAPS thinks a TBR is still active
|
||||||
|
.message("No TBR active");
|
||||||
}
|
}
|
||||||
return new SetTbrCommand(100, 0).execute(scripter);
|
return new SetTbrCommand(100, 0).execute(scripter);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue