From a615553047a25834a8a23bf4cf4628173019b2c9 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Thu, 5 Apr 2018 10:02:57 +0200 Subject: [PATCH] check for profile already set before notification --- .../nightscout/androidaps/queue/CommandQueue.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/queue/CommandQueue.java b/app/src/main/java/info/nightscout/androidaps/queue/CommandQueue.java index 141d064682..8b7b2f8fbe 100644 --- a/app/src/main/java/info/nightscout/androidaps/queue/CommandQueue.java +++ b/app/src/main/java/info/nightscout/androidaps/queue/CommandQueue.java @@ -299,6 +299,13 @@ public class CommandQueue { // returns true if command is queued public boolean setProfile(Profile profile, Callback callback) { + if (isThisProfileSet(profile)) { + log.debug("QUEUE: Correct profile already set"); + if (callback != null) + callback.result(new PumpEnactResult().success(true).enacted(false)).run(); + return false; + } + if (isRunning(Command.CommandType.BASALPROFILE)) { if (callback != null) callback.result(executingNowError()).run(); @@ -329,13 +336,6 @@ public class CommandQueue { MainApp.bus().post(new EventDismissNotification(Notification.BASAL_VALUE_BELOW_MINIMUM)); - if (isThisProfileSet(profile)) { - log.debug("QUEUE: Correct profile already set"); - if (callback != null) - callback.result(new PumpEnactResult().success(true).enacted(false)).run(); - return false; - } - // remove all unfinished removeAll(Command.CommandType.BASALPROFILE);