fix false constraint warning
This commit is contained in:
parent
cc934d3e89
commit
42714afeb1
|
@ -74,7 +74,7 @@ public class NewExtendedBolusDialog extends DialogFragment implements View.OnCli
|
|||
Double insulinAfterConstraint = MainApp.getConstraintChecker().applyExtendedBolusConstraints(new Constraint<>(insulin)).value();
|
||||
confirmMessage += " " + insulinAfterConstraint + " U ";
|
||||
confirmMessage += MainApp.gs(R.string.duration) + " " + durationInMinutes + "min ?";
|
||||
if (insulinAfterConstraint - insulin != 0d)
|
||||
if (Math.abs(insulinAfterConstraint - insulin) > 0.01d)
|
||||
confirmMessage += "\n" + MainApp.gs(R.string.constraintapllied);
|
||||
insulin = insulinAfterConstraint;
|
||||
|
||||
|
|
|
@ -136,7 +136,7 @@ public class NewTempBasalDialog extends DialogFragment implements View.OnClickLi
|
|||
absolute = MainApp.getConstraintChecker().applyBasalConstraints(new Constraint<>(basalAbsoluteInput), profile).value();
|
||||
confirmMessage += "\n" + absolute + " U/h ";
|
||||
confirmMessage += "\n" + MainApp.gs(R.string.duration) + " " + durationInMinutes + "min ?";
|
||||
if (absolute - basalAbsoluteInput != 0d)
|
||||
if (Math.abs(absolute - basalAbsoluteInput) > 0.01d)
|
||||
confirmMessage += "\n" + MainApp.gs(R.string.constraintapllied);
|
||||
}
|
||||
|
||||
|
|
|
@ -141,7 +141,7 @@ public class NewTreatmentDialog extends DialogFragment implements OnClickListene
|
|||
}
|
||||
if (carbsAfterConstraints > 0)
|
||||
confirmMessage += "<br/>" + MainApp.gs(R.string.carbs) + ": " + carbsAfterConstraints + "g";
|
||||
if (insulinAfterConstraints - insulin != 0 || !Objects.equals(carbsAfterConstraints, carbs))
|
||||
if (Math.abs(insulinAfterConstraints - insulin) > 0.01d || !Objects.equals(carbsAfterConstraints, carbs))
|
||||
confirmMessage += "<br/>" + MainApp.gs(R.string.constraintapllied);
|
||||
|
||||
|
||||
|
|
|
@ -339,7 +339,7 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
|
|||
if (carbsAfterConstraints > 0)
|
||||
confirmMessage += "<br/>" + MainApp.gs(R.string.carbs) + ": " + "<font color='" + MainApp.gc(R.color.carbs) + "'>" + carbsAfterConstraints + "g" + "</font>";
|
||||
|
||||
if (insulinAfterConstraints - calculatedTotalInsulin != 0 || !carbsAfterConstraints.equals(calculatedCarbs)) {
|
||||
if (Math.abs(insulinAfterConstraints - calculatedTotalInsulin) > 0.01d || !carbsAfterConstraints.equals(calculatedCarbs)) {
|
||||
okClicked = false;
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||
builder.setTitle(MainApp.gs(R.string.treatmentdeliveryerror));
|
||||
|
@ -496,13 +496,13 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
|
|||
Double corrAfterConstraint = c_correction;
|
||||
if (c_correction > 0)
|
||||
c_correction = MainApp.getConstraintChecker().applyBolusConstraints(new Constraint<>(c_correction)).value();
|
||||
if (c_correction - corrAfterConstraint != 0) { // c_correction != corrAfterConstraint doesn't work
|
||||
if (Math.abs(c_correction - corrAfterConstraint) > 0.01d) { // c_correction != corrAfterConstraint doesn't work
|
||||
editCorr.setValue(0d);
|
||||
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.gs(R.string.bolusconstraintapplied));
|
||||
return;
|
||||
}
|
||||
Integer carbsAfterConstraint = MainApp.getConstraintChecker().applyCarbsConstraints(new Constraint<>(c_carbs)).value();
|
||||
if (c_carbs - carbsAfterConstraint != 0) {
|
||||
if (Math.abs(c_carbs - carbsAfterConstraint) > 0.01d) {
|
||||
editCarbs.setValue(0d);
|
||||
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.gs(R.string.carbsconstraintapplied));
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue