Apply bolus constraint before applying.

This commit is contained in:
Johannes Mockenhaupt 2017-12-12 22:30:42 +01:00
parent e14272c083
commit f6721f628c
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));
@ -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 {