Merge branch 'queue-bolus-constraints' into combo-scripter-v2

* queue-bolus-constraints:
  Apply bolus constraint before applying.

# Conflicts:
#	app/src/main/java/info/nightscout/androidaps/queue/CommandQueue.java
This commit is contained in:
Johannes Mockenhaupt 2017-12-18 21:06:31 +01:00
commit 9eefae4f67
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1

View file

@ -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));
@ -161,14 +165,9 @@ public class CommandQueue {
// Notify Wear about upcoming bolus
MainApp.bus().post(new EventBolusRequested(detailedBolusInfo.insulin));
// Apply constraints
detailedBolusInfo.insulin = MainApp.getConfigBuilder().applyBolusConstraints(detailedBolusInfo.insulin);
detailedBolusInfo.carbs = MainApp.getConfigBuilder().applyCarbsConstraints((int) detailedBolusInfo.carbs);
// Bring up bolus progress dialog
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 {