fix double carbs when carbtime != 0
This commit is contained in:
parent
47bff5ad5e
commit
77916ec4ae
1 changed files with 3 additions and 1 deletions
|
@ -364,7 +364,8 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
Treatment t = new Treatment();
|
Treatment t = new Treatment();
|
||||||
t.insulin = result.bolusDelivered;
|
t.insulin = result.bolusDelivered;
|
||||||
t.carbs = (double) result.carbsDelivered;
|
if (carbTime == 0)
|
||||||
|
t.carbs = (double) result.carbsDelivered; // with different carbTime record will come back from nightscout
|
||||||
t.created_at = new Date();
|
t.created_at = new Date();
|
||||||
try {
|
try {
|
||||||
MainApp.getDbHelper().getDaoTreatments().create(t);
|
MainApp.getDbHelper().getDaoTreatments().create(t);
|
||||||
|
@ -372,6 +373,7 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
t.setTimeIndex(t.getTimeIndex());
|
t.setTimeIndex(t.getTimeIndex());
|
||||||
|
t.carbs = (double) result.carbsDelivered;
|
||||||
uploadBolusWizardRecord(t, glucose, glucoseType, carbTime, boluscalc);
|
uploadBolusWizardRecord(t, glucose, glucoseType, carbTime, boluscalc);
|
||||||
MainApp.bus().post(new EventTreatmentChange());
|
MainApp.bus().post(new EventTreatmentChange());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue