check for profile already set before notification

This commit is contained in:
Milos Kozak 2018-04-05 10:02:57 +02:00
parent aebaa76864
commit a615553047

View file

@ -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);