From 3f8e56d50eb21d0119df94ae7d554fe509b6f812 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Mon, 18 Oct 2021 20:10:18 +0200 Subject: [PATCH] Fix Objectives processing --- .../java/info/nightscout/androidaps/dialogs/LoopDialog.kt | 1 + .../info/nightscout/androidaps/dialogs/ProfileSwitchDialog.kt | 1 + .../plugins/constraints/objectives/objectives/Objective.kt | 4 ++-- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/LoopDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/LoopDialog.kt index 87664dd591..8542d3dcf6 100644 --- a/app/src/main/java/info/nightscout/androidaps/dialogs/LoopDialog.kt +++ b/app/src/main/java/info/nightscout/androidaps/dialogs/LoopDialog.kt @@ -412,6 +412,7 @@ class LoopDialog : DaggerDialogFragment() { loopPlugin.goToZeroTemp(T.hours(1).mins().toInt(), profile, OfflineEvent.Reason.DISCONNECT_PUMP) rxBus.send(EventRefreshOverview("suspend_menu")) } + sp.putBoolean(R.string.key_objectiveusedisconnect, true) return true } diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/ProfileSwitchDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/ProfileSwitchDialog.kt index a2b109316d..77a2418cca 100644 --- a/app/src/main/java/info/nightscout/androidaps/dialogs/ProfileSwitchDialog.kt +++ b/app/src/main/java/info/nightscout/androidaps/dialogs/ProfileSwitchDialog.kt @@ -185,6 +185,7 @@ class ProfileSwitchDialog : DialogFragmentWithDate() { ValueWithUnit.Percent(percent), ValueWithUnit.Hour(timeShift).takeIf { timeShift != 0 }, ValueWithUnit.Minute(duration).takeIf { duration != 0 }) + if (percent == 90 && duration == 10) sp.putBoolean(R.string.key_objectiveuseprofileswitch, true) if (isTT) { disposable += repository.runTransactionForResult( InsertAndCancelCurrentTemporaryTargetTransaction( diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/objectives/Objective.kt b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/objectives/Objective.kt index 71f258781d..0a0e1477f5 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/objectives/Objective.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/objectives/Objective.kt @@ -86,10 +86,10 @@ abstract class Objective(injector: HasAndroidInjector, spName: String, @StringRe abstract fun isCompleted(): Boolean - open fun isCompleted(trueTime: Long): Boolean = isCompleted + open fun isCompleted(trueTime: Long): Boolean = isCompleted() open val progress: String - get() = resourceHelper.gs(if (isCompleted) R.string.completed_well_done else R.string.not_completed_yet) + get() = resourceHelper.gs(if (isCompleted()) R.string.completed_well_done else R.string.not_completed_yet) fun hint(hint: Hint): Task { hints.add(hint)