From 35a6bbb6a7be8613e5ca6b389ce6b87c48859db8 Mon Sep 17 00:00:00 2001 From: Johannes Mockenhaupt Date: Fri, 4 May 2018 14:22:43 +0200 Subject: [PATCH] Set CareportalEvent.MEALBOLUS for eCarbs. --- .../plugins/Overview/Dialogs/NewCarbsDialog.java | 7 +------ .../androidaps/plugins/Treatments/CarbsGenerator.java | 6 +++--- .../androidaps/plugins/Wear/ActionStringHandler.java | 7 +------ 3 files changed, 5 insertions(+), 15 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewCarbsDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewCarbsDialog.java index d591c880b9..2ebab6caab 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewCarbsDialog.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewCarbsDialog.java @@ -1,9 +1,7 @@ package info.nightscout.androidaps.plugins.Overview.Dialogs; -import android.content.Intent; import android.os.Bundle; import android.os.HandlerThread; -import android.support.annotation.Nullable; import android.support.v4.app.DialogFragment; import android.support.v7.app.AlertDialog; import android.text.Editable; @@ -33,16 +31,13 @@ import java.util.List; import info.nightscout.androidaps.Constants; import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.R; -import info.nightscout.androidaps.data.DetailedBolusInfo; import info.nightscout.androidaps.data.Profile; import info.nightscout.androidaps.db.CareportalEvent; import info.nightscout.androidaps.db.Source; import info.nightscout.androidaps.db.TempTarget; import info.nightscout.androidaps.interfaces.Constraint; -import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin; import info.nightscout.androidaps.plugins.Treatments.CarbsGenerator; import info.nightscout.androidaps.plugins.Treatments.TreatmentsPlugin; -import info.nightscout.androidaps.queue.Callback; import info.nightscout.utils.DateUtil; import info.nightscout.utils.DecimalFormatter; import info.nightscout.utils.DefaultValueHelper; @@ -396,7 +391,7 @@ public class NewCarbsDialog extends DialogFragment implements OnClickListener, C if (carbsAfterConstraints > 0) { if (duration == 0) { - CarbsGenerator.createCarb(carbsAfterConstraints, time, notes); + CarbsGenerator.createCarb(carbsAfterConstraints, time, CareportalEvent.CARBCORRECTION, notes); } else { CarbsGenerator.generateCarbs(carbsAfterConstraints, time, duration, notes); } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/CarbsGenerator.java b/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/CarbsGenerator.java index d270187eca..99168a2776 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/CarbsGenerator.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/CarbsGenerator.java @@ -23,14 +23,14 @@ public class CarbsGenerator { int smallCarbAmount = (int) Math.round((1d * remainingCarbs) / (ticks-i)); //on last iteration (ticks-i) is 1 -> smallCarbAmount == remainingCarbs remainingCarbs -= smallCarbAmount; if (smallCarbAmount > 0) - createCarb(smallCarbAmount, carbTime, notes); + createCarb(smallCarbAmount, carbTime, CareportalEvent.MEALBOLUS, notes); } } - public static void createCarb(int carbs, long time, @Nullable String notes) { + public static void createCarb(int carbs, long time, String eventType, @Nullable String notes) { DetailedBolusInfo carbInfo = new DetailedBolusInfo(); carbInfo.date = time; - carbInfo.eventType = CareportalEvent.CARBCORRECTION; + carbInfo.eventType = eventType; carbInfo.carbs = carbs; carbInfo.context = MainApp.instance(); carbInfo.source = Source.USER; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Wear/ActionStringHandler.java b/app/src/main/java/info/nightscout/androidaps/plugins/Wear/ActionStringHandler.java index 35b8fe72c2..5ec2723fa4 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Wear/ActionStringHandler.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Wear/ActionStringHandler.java @@ -1,9 +1,7 @@ package info.nightscout.androidaps.plugins.Wear; -import android.content.Intent; import android.os.HandlerThread; import android.support.annotation.NonNull; -import android.support.annotation.Nullable; import java.text.DateFormat; import java.text.DecimalFormat; @@ -38,7 +36,6 @@ import info.nightscout.androidaps.plugins.IobCobCalculator.CobInfo; import info.nightscout.androidaps.plugins.IobCobCalculator.IobCobCalculatorPlugin; import info.nightscout.androidaps.plugins.Loop.APSResult; import info.nightscout.androidaps.plugins.Loop.LoopPlugin; -import info.nightscout.androidaps.plugins.Overview.Dialogs.ErrorHelperActivity; import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification; import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPlugin; import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump; @@ -57,8 +54,6 @@ import info.nightscout.utils.SP; import info.nightscout.utils.SafeParse; import info.nightscout.utils.ToastUtils; -import static info.nightscout.utils.DateUtil.now; - /** * Created by adrian on 09/02/17. */ @@ -634,7 +629,7 @@ public class ActionStringHandler { private static void doECarbs(int carbs, long time, int duration) { if (carbs > 0) { if (duration == 0) { - CarbsGenerator.createCarb(carbs, time, "watch"); + CarbsGenerator.createCarb(carbs, time, CareportalEvent.CARBCORRECTION, "watch"); } else { CarbsGenerator.generateCarbs(carbs, time, duration, "watch eCarbs"); }