From 843fccb86cc413bb88004fe0c2f3cb1f17f56777 Mon Sep 17 00:00:00 2001 From: Johannes Mockenhaupt Date: Sun, 22 Mar 2020 11:54:31 +0100 Subject: [PATCH 1/5] SmsCommunicatorPlugin.processCARBS: set source on record. --- .../plugins/general/smsCommunicator/SmsCommunicatorPlugin.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/smsCommunicator/SmsCommunicatorPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/smsCommunicator/SmsCommunicatorPlugin.kt index 0021574812..41c28bbf21 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/smsCommunicator/SmsCommunicatorPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/smsCommunicator/SmsCommunicatorPlugin.kt @@ -713,6 +713,7 @@ object SmsCommunicatorPlugin : PluginBase(PluginDescription() override fun run() { val detailedBolusInfo = DetailedBolusInfo() detailedBolusInfo.carbs = anInteger().toDouble() + detailedBolusInfo.source = Source.USER detailedBolusInfo.date = secondLong() ConfigBuilderPlugin.getPlugin().commandQueue.bolus(detailedBolusInfo, object : Callback() { override fun run() { From e7c7ce32bb085ed228cc0663b58061dd0d7aa4d0 Mon Sep 17 00:00:00 2001 From: Johannes Mockenhaupt Date: Sun, 22 Mar 2020 11:57:29 +0100 Subject: [PATCH 2/5] TreatmentService.createOrUpdate: log invalid argument. --- .../androidaps/plugins/treatments/TreatmentService.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/TreatmentService.java b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/TreatmentService.java index 1b118da1d3..eae623267e 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/TreatmentService.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/TreatmentService.java @@ -280,6 +280,10 @@ public class TreatmentService extends OrmLiteBaseService { // return true if new record is created public UpdateReturn createOrUpdate(Treatment treatment) { + if (treatment != null && treatment.source == Source.NONE) { + log.error("Coder error: source is not set for treatment: " + treatment, new Exception()); + FabricPrivacy.logException(new Exception("Coder error: source is not set for treatment: " + treatment)); + } try { Treatment old; treatment.date = DatabaseHelper.roundDateToSec(treatment.date); From fce6ec8d2581ed3becfa82a6c17ab3c42a0c88cf Mon Sep 17 00:00:00 2001 From: Johannes Mockenhaupt Date: Tue, 24 Mar 2020 21:27:38 +0100 Subject: [PATCH 3/5] SmsCommunicator: only ask pump with support to add carbs. This aligns with how this is generally handles elsewhere: check if a pump supports carbs and if not, don't bother the driver but add the carbs directly via TreatmentsPlugin. --- .../smsCommunicator/SmsCommunicatorPlugin.kt | 31 ++++++++++++------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/smsCommunicator/SmsCommunicatorPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/smsCommunicator/SmsCommunicatorPlugin.kt index 41c28bbf21..433acf9403 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/smsCommunicator/SmsCommunicatorPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/smsCommunicator/SmsCommunicatorPlugin.kt @@ -715,19 +715,26 @@ object SmsCommunicatorPlugin : PluginBase(PluginDescription() detailedBolusInfo.carbs = anInteger().toDouble() detailedBolusInfo.source = Source.USER detailedBolusInfo.date = secondLong() - ConfigBuilderPlugin.getPlugin().commandQueue.bolus(detailedBolusInfo, object : Callback() { - override fun run() { - if (result.success) { - var replyText = String.format(MainApp.gs(R.string.smscommunicator_carbsset), anInteger) - replyText += "\n" + ConfigBuilderPlugin.getPlugin().activePump?.shortStatus(true) - sendSMSToAllNumbers(Sms(receivedSms.phoneNumber, replyText)) - } else { - var replyText = MainApp.gs(R.string.smscommunicator_carbsfailed) - replyText += "\n" + ConfigBuilderPlugin.getPlugin().activePump?.shortStatus(true) - sendSMS(Sms(receivedSms.phoneNumber, replyText)) + if (ConfigBuilderPlugin.getPlugin().activePump?.pumpDescription?.storesCarbInfo == true) { + ConfigBuilderPlugin.getPlugin().commandQueue.bolus(detailedBolusInfo, object : Callback() { + override fun run() { + if (result.success) { + var replyText = String.format(MainApp.gs(R.string.smscommunicator_carbsset), anInteger) + replyText += "\n" + ConfigBuilderPlugin.getPlugin().activePump?.shortStatus(true) + sendSMSToAllNumbers(Sms(receivedSms.phoneNumber, replyText)) + } else { + var replyText = MainApp.gs(R.string.smscommunicator_carbsfailed) + replyText += "\n" + ConfigBuilderPlugin.getPlugin().activePump?.shortStatus(true) + sendSMS(Sms(receivedSms.phoneNumber, replyText)) + } } - } - }) + }) + } else { + TreatmentsPlugin.getPlugin().addToHistoryTreatment(detailedBolusInfo, true) + var replyText = String.format(MainApp.gs(R.string.smscommunicator_carbsset), anInteger) + replyText += "\n" + ConfigBuilderPlugin.getPlugin().activePump?.shortStatus(true) + sendSMSToAllNumbers(Sms(receivedSms.phoneNumber, replyText)) + } } }) } From 856ef12f167601b82013dbec2c4f4dc719ef51a4 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Sun, 5 Apr 2020 18:33:39 +0200 Subject: [PATCH 4/5] New translations objectives.xml (Dutch) --- app/src/main/res/values-nl-rNL/objectives.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/main/res/values-nl-rNL/objectives.xml b/app/src/main/res/values-nl-rNL/objectives.xml index c9e23d317a..613bcfa9e6 100644 --- a/app/src/main/res/values-nl-rNL/objectives.xml +++ b/app/src/main/res/values-nl-rNL/objectives.xml @@ -35,6 +35,7 @@ Inhoud van loop plugin weergeven Gebruik de schaalfunctie: houd de BG grafiek lang ingedrukt Enter + Als je ten minste 3 maanden closed loop ervaring hebt met een ander doe-het-zelf systeem dan kun je wellicht een code aanvragen om doelen over te slaan. Zie https://androidaps.readthedocs.io/en/latest/CROWDIN/nl/Usage/Objectives.html#doelen-overslaan voor details. Code geaccepteerd Code ongeldig Bewijs je kennis From 98af8531f0dc7883a9bab2f85061f690838b0c43 Mon Sep 17 00:00:00 2001 From: Winfried Kuiper Date: Sun, 5 Apr 2020 21:11:13 +0200 Subject: [PATCH 5/5] Typo in log message (#2547) --- .../plugins/constraints/versionChecker/VersionCheckerUtils.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/versionChecker/VersionCheckerUtils.kt b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/versionChecker/VersionCheckerUtils.kt index ac9724608f..91f1438d4a 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/versionChecker/VersionCheckerUtils.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/versionChecker/VersionCheckerUtils.kt @@ -46,7 +46,7 @@ private fun checkVersion() = if (isConnected()) { } }.start() } else - log.debug("Github master version no checked. No connectivity") + log.debug("Github master version not checked. No connectivity") fun compareWithCurrentVersion(newVersion: String?, currentVersion: String) {