From f118efa6ede557afac235e12441e0d2f9a287324 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Fri, 27 Sep 2019 18:03:58 +0200 Subject: [PATCH] objectives fix --- .../plugins/constraints/objectives/ObjectivesPlugin.kt | 2 +- .../constraints/objectives/objectives/Objective.java | 6 +++++- app/src/main/res/values/exam.xml | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/ObjectivesPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/ObjectivesPlugin.kt index dcd9dd31d1..7913e73426 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/ObjectivesPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/ObjectivesPlugin.kt @@ -64,7 +64,7 @@ object ObjectivesPlugin : PluginBase(PluginDescription() private fun doConvertSP(number: Int, name: String) { if (!SP.contains("Objectives_" + name + "_started")) { - SP.putLong("Objectives_" + name + "_started", SP.getLong("Objectives" + number + "accomplished", 0L)) + SP.putLong("Objectives_" + name + "_started", SP.getLong("Objectives" + number + "started", 0L)) SP.putLong("Objectives_" + name + "_accomplished", SP.getLong("Objectives" + number + "accomplished", 0L)) } // TODO: we can remove Objectives1accomplished sometimes later diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/objectives/Objective.java b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/objectives/Objective.java index a59a33454d..0eb4ed8fb7 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/objectives/Objective.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/objectives/Objective.java @@ -36,6 +36,10 @@ public abstract class Objective { this.gate = gate; startedOn = SP.getLong("Objectives_" + spName + "_started", 0L); accomplishedOn = SP.getLong("Objectives_" + spName + "_accomplished", 0L); + if ((accomplishedOn - DateUtil.now()) > T.days(1).msecs()) { // more than 1 day in the future + setStartedOn(0); + setAccomplishedOn(0); + } setupTasks(tasks); for (Task task : tasks) task.objective = this; } @@ -53,7 +57,7 @@ public abstract class Objective { } public boolean isAccomplished() { - return accomplishedOn != 0; + return accomplishedOn != 0 && accomplishedOn < DateUtil.now(); } public boolean isStarted() { diff --git a/app/src/main/res/values/exam.xml b/app/src/main/res/values/exam.xml index 0ca4e78ddb..4b869dcfa0 100644 --- a/app/src/main/res/values/exam.xml +++ b/app/src/main/res/values/exam.xml @@ -75,7 +75,7 @@ What is true? You need to have Git installed. Update as soon as new version is released. - You can use the same signing keys. + You should use the same signing keys. Never update if the system is working well. Ask your friend for the new APK. https://androidaps.readthedocs.io/en/latest/EN/Installing-AndroidAPS/Update-to-new-version.html#update-to-a-new-version-or-branch @@ -142,7 +142,7 @@ IC value will be 10% lower. ISF value will be 10% higher. ISF value will be 10% lower. - You will get 10% less insulin in total. + You will get around 10% less insulin in total. Target wiil be 10% higher. Target will be 10% lower. Only bottom target will be 10% lower.