From 77916ec4aef57108daa4af68c00e0bf5522ec520 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Fri, 9 Sep 2016 11:04:50 +0200 Subject: [PATCH] fix double carbs when carbtime != 0 --- .../androidaps/plugins/ConfigBuilder/ConfigBuilderPlugin.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/ConfigBuilder/ConfigBuilderPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/ConfigBuilder/ConfigBuilderPlugin.java index b02aa6ebf7..5db43cd51d 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/ConfigBuilder/ConfigBuilderPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/ConfigBuilder/ConfigBuilderPlugin.java @@ -364,7 +364,8 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain if (result.success) { Treatment t = new Treatment(); 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(); try { MainApp.getDbHelper().getDaoTreatments().create(t); @@ -372,6 +373,7 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain e.printStackTrace(); } t.setTimeIndex(t.getTimeIndex()); + t.carbs = (double) result.carbsDelivered; uploadBolusWizardRecord(t, glucose, glucoseType, carbTime, boluscalc); MainApp.bus().post(new EventTreatmentChange()); }