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:
Johannes Mockenhaupt 2017-07-14 23:00:15 +02:00
parent 264e252300
commit 9674db8d85
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1

View file

@ -13,7 +13,11 @@ public class CancelTbrCommand implements Command {
Double tbrPercentage = (Double) scripter.currentMenu.getAttribute(MenuAttribute.TBR);
boolean runtimeDisplayed = scripter.currentMenu.attributes().contains(MenuAttribute.RUNTIME);
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);
}