From f6721f628cadb51bc7ce50a605daa4c71c90ae82 Mon Sep 17 00:00:00 2001 From: Johannes Mockenhaupt Date: Tue, 12 Dec 2017 22:30:42 +0100 Subject: [PATCH] Apply bolus constraint before applying. --- .../info/nightscout/androidaps/queue/CommandQueue.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 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 eea2635ae7..af768e4888 100644 --- a/app/src/main/java/info/nightscout/androidaps/queue/CommandQueue.java +++ b/app/src/main/java/info/nightscout/androidaps/queue/CommandQueue.java @@ -153,6 +153,10 @@ public class CommandQueue { // remove all unfinished boluses removeAll(Command.CommandType.BOLUS); + // apply constraints + detailedBolusInfo.insulin = MainApp.getConfigBuilder().applyBolusConstraints(detailedBolusInfo.insulin); + detailedBolusInfo.carbs = MainApp.getConfigBuilder().applyCarbsConstraints((int) detailedBolusInfo.carbs); + // add new command to queue add(new CommandBolus(detailedBolusInfo, callback)); @@ -162,12 +166,8 @@ public class CommandQueue { MainApp.bus().post(new EventBolusRequested(detailedBolusInfo.insulin)); // Bring up bolus progress dialog - detailedBolusInfo.insulin = MainApp.getConfigBuilder().applyBolusConstraints(detailedBolusInfo.insulin); - detailedBolusInfo.carbs = MainApp.getConfigBuilder().applyCarbsConstraints((int) detailedBolusInfo.carbs); - - BolusProgressDialog bolusProgressDialog = null; if (detailedBolusInfo.context != null) { - bolusProgressDialog = new BolusProgressDialog(); + BolusProgressDialog bolusProgressDialog = new BolusProgressDialog(); bolusProgressDialog.setInsulin(detailedBolusInfo.insulin); bolusProgressDialog.show(((AppCompatActivity) detailedBolusInfo.context).getSupportFragmentManager(), "BolusProgress"); } else {