From 9674db8d855a09b8cdd673b261d76575694ae624 Mon Sep 17 00:00:00 2001 From: Johannes Mockenhaupt Date: Fri, 14 Jul 2017 23:00:15 +0200 Subject: [PATCH] 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. --- .../de/jotomo/ruffyscripter/commands/CancelTbrCommand.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/de/jotomo/ruffyscripter/commands/CancelTbrCommand.java b/app/src/main/java/de/jotomo/ruffyscripter/commands/CancelTbrCommand.java index ed9fb1e18f..2f5c03f6e5 100644 --- a/app/src/main/java/de/jotomo/ruffyscripter/commands/CancelTbrCommand.java +++ b/app/src/main/java/de/jotomo/ruffyscripter/commands/CancelTbrCommand.java @@ -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); }