From a0812664d9ef899c408ce7a14a3ce46b9eb2c850 Mon Sep 17 00:00:00 2001 From: "Casper V. Kristensen" Date: Sat, 16 Mar 2024 16:09:21 +0100 Subject: [PATCH] chill objectives --- .../constraints/objectives/objectives/Objective.kt | 4 ++-- .../objectives/objectives/Objective0.kt | 14 +------------- .../objectives/objectives/Objective10.kt | 2 +- .../objectives/objectives/Objective11.kt | 2 +- .../objectives/objectives/Objective3.kt | 2 +- .../objectives/objectives/Objective5.kt | 2 +- .../objectives/objectives/Objective6.kt | 2 +- .../objectives/objectives/Objective7.kt | 2 +- .../objectives/objectives/Objective9.kt | 2 +- 9 files changed, 10 insertions(+), 22 deletions(-) diff --git a/plugins/constraints/src/main/kotlin/app/aaps/plugins/constraints/objectives/objectives/Objective.kt b/plugins/constraints/src/main/kotlin/app/aaps/plugins/constraints/objectives/objectives/Objective.kt index 939ce13913..cfa0fcd89f 100644 --- a/plugins/constraints/src/main/kotlin/app/aaps/plugins/constraints/objectives/objectives/Objective.kt +++ b/plugins/constraints/src/main/kotlin/app/aaps/plugins/constraints/objectives/objectives/Objective.kt @@ -149,7 +149,7 @@ abstract class Objective(injector: HasAndroidInjector, spName: String, @StringRe override fun isCompleted(): Boolean = answered - fun isEnabledAnswer(): Boolean = disabledTo < dateUtil.now() + fun isEnabledAnswer(): Boolean = true fun option(option: Option): ExamTask { options.add(option) @@ -187,4 +187,4 @@ abstract class Objective(injector: HasAndroidInjector, spName: String, @StringRe } inner class Learned internal constructor(@StringRes var learned: Int) -} \ No newline at end of file +} diff --git a/plugins/constraints/src/main/kotlin/app/aaps/plugins/constraints/objectives/objectives/Objective0.kt b/plugins/constraints/src/main/kotlin/app/aaps/plugins/constraints/objectives/objectives/Objective0.kt index b838236ddf..30269d8ff5 100644 --- a/plugins/constraints/src/main/kotlin/app/aaps/plugins/constraints/objectives/objectives/Objective0.kt +++ b/plugins/constraints/src/main/kotlin/app/aaps/plugins/constraints/objectives/objectives/Objective0.kt @@ -22,11 +22,6 @@ class Objective0(injector: HasAndroidInjector) : Objective(injector, "config", R val tidepoolPlugin get() = activePlugin.getSpecificPluginsListByInterface(Tidepool::class.java).firstOrNull() as Tidepool? init { - tasks.add(object : Task(this, R.string.objectives_bgavailableinns) { - override fun isCompleted(): Boolean { - return sp.getBoolean(app.aaps.core.utils.R.string.key_objectives_bg_is_available_in_ns, false) || tidepoolPlugin?.hasWritePermission == true - } - }) tasks.add(object : Task(this, R.string.synchaswritepermission) { override fun isCompleted(): Boolean { return activePlugin.firstActiveSync?.hasWritePermission == true || tidepoolPlugin?.hasWritePermission == true @@ -41,13 +36,6 @@ class Objective0(injector: HasAndroidInjector) : Objective(injector, "config", R return !virtualPumpPlugin.isEnabled() } }) - tasks.add( - object : Task(this, R.string.objectives_pumpstatusavailableinns) { - override fun isCompleted(): Boolean { - return sp.getBoolean(app.aaps.core.utils.R.string.key_objectives_pump_status_is_available_in_ns, false) || tidepoolPlugin?.hasWritePermission == true - } - }.learned(Learned(R.string.objectives_0_learned)) - ) tasks.add(object : Task(this, R.string.hasbgdata) { override fun isCompleted(): Boolean { return iobCobCalculator.ads.lastBg() != null @@ -70,4 +58,4 @@ class Objective0(injector: HasAndroidInjector) : Objective(injector, "config", R } }) } -} \ No newline at end of file +} diff --git a/plugins/constraints/src/main/kotlin/app/aaps/plugins/constraints/objectives/objectives/Objective10.kt b/plugins/constraints/src/main/kotlin/app/aaps/plugins/constraints/objectives/objectives/Objective10.kt index 02c6fbef4b..d53c7f7c03 100644 --- a/plugins/constraints/src/main/kotlin/app/aaps/plugins/constraints/objectives/objectives/Objective10.kt +++ b/plugins/constraints/src/main/kotlin/app/aaps/plugins/constraints/objectives/objectives/Objective10.kt @@ -8,7 +8,7 @@ class Objective10(injector: HasAndroidInjector) : Objective(injector, "auto", R. init { tasks.add( - MinimumDurationTask(this, T.days(28).msecs()) + MinimumDurationTask(this, T.mins(28).msecs()) .learned(Learned(R.string.objectives_autosens_learned)) ) } diff --git a/plugins/constraints/src/main/kotlin/app/aaps/plugins/constraints/objectives/objectives/Objective11.kt b/plugins/constraints/src/main/kotlin/app/aaps/plugins/constraints/objectives/objectives/Objective11.kt index c8c0fcf270..2784c47392 100644 --- a/plugins/constraints/src/main/kotlin/app/aaps/plugins/constraints/objectives/objectives/Objective11.kt +++ b/plugins/constraints/src/main/kotlin/app/aaps/plugins/constraints/objectives/objectives/Objective11.kt @@ -8,7 +8,7 @@ class Objective11(injector: HasAndroidInjector) : Objective(injector, "dyn_isf", init { tasks.add( - MinimumDurationTask(this, T.days(28).msecs()) + MinimumDurationTask(this, T.mins(28).msecs()) .learned(Learned(R.string.objectives_dyn_isf_learned)) ) } diff --git a/plugins/constraints/src/main/kotlin/app/aaps/plugins/constraints/objectives/objectives/Objective3.kt b/plugins/constraints/src/main/kotlin/app/aaps/plugins/constraints/objectives/objectives/Objective3.kt index 516cbf8f71..3c4c46b81c 100644 --- a/plugins/constraints/src/main/kotlin/app/aaps/plugins/constraints/objectives/objectives/Objective3.kt +++ b/plugins/constraints/src/main/kotlin/app/aaps/plugins/constraints/objectives/objectives/Objective3.kt @@ -12,7 +12,7 @@ class Objective3 @Inject constructor(injector: HasAndroidInjector) : Objective(i @Inject lateinit var activePlugin: ActivePlugin init { - tasks.add(MinimumDurationTask(this, T.days(7).msecs())) + tasks.add(MinimumDurationTask(this, T.mins(7).msecs())) tasks.add( object : Task(this, R.string.objectives_manualenacts) { override fun isCompleted(): Boolean { diff --git a/plugins/constraints/src/main/kotlin/app/aaps/plugins/constraints/objectives/objectives/Objective5.kt b/plugins/constraints/src/main/kotlin/app/aaps/plugins/constraints/objectives/objectives/Objective5.kt index a8496c8c8f..ce9c50dede 100644 --- a/plugins/constraints/src/main/kotlin/app/aaps/plugins/constraints/objectives/objectives/Objective5.kt +++ b/plugins/constraints/src/main/kotlin/app/aaps/plugins/constraints/objectives/objectives/Objective5.kt @@ -15,7 +15,7 @@ class Objective5(injector: HasAndroidInjector) : Objective(injector, "maxiobzero @Inject lateinit var aapsLogger: AAPSLogger init { - tasks.add(MinimumDurationTask(this, T.days(5).msecs())) + tasks.add(MinimumDurationTask(this, T.mins(5).msecs())) tasks.add( object : Task(this, R.string.closedmodeenabled) { override fun isCompleted(): Boolean { diff --git a/plugins/constraints/src/main/kotlin/app/aaps/plugins/constraints/objectives/objectives/Objective6.kt b/plugins/constraints/src/main/kotlin/app/aaps/plugins/constraints/objectives/objectives/Objective6.kt index 4288c4622a..da9eef35b6 100644 --- a/plugins/constraints/src/main/kotlin/app/aaps/plugins/constraints/objectives/objectives/Objective6.kt +++ b/plugins/constraints/src/main/kotlin/app/aaps/plugins/constraints/objectives/objectives/Objective6.kt @@ -13,7 +13,7 @@ class Objective6(injector: HasAndroidInjector) : Objective(injector, "maxiob", R @Inject lateinit var constraintChecker: ConstraintsChecker init { - tasks.add(MinimumDurationTask(this, T.days(1).msecs())) + tasks.add(MinimumDurationTask(this, T.mins(1).msecs())) tasks.add( object : Task(this, R.string.closedmodeenabled) { override fun isCompleted(): Boolean = ApsMode.fromString(sp.getString(app.aaps.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)) == ApsMode.CLOSED diff --git a/plugins/constraints/src/main/kotlin/app/aaps/plugins/constraints/objectives/objectives/Objective7.kt b/plugins/constraints/src/main/kotlin/app/aaps/plugins/constraints/objectives/objectives/Objective7.kt index f018bab750..72b08187df 100644 --- a/plugins/constraints/src/main/kotlin/app/aaps/plugins/constraints/objectives/objectives/Objective7.kt +++ b/plugins/constraints/src/main/kotlin/app/aaps/plugins/constraints/objectives/objectives/Objective7.kt @@ -8,7 +8,7 @@ class Objective7(injector: HasAndroidInjector) : Objective(injector, "autosens", init { tasks.add( - MinimumDurationTask(this, T.days(7).msecs()) + MinimumDurationTask(this, T.mins(7).msecs()) .learned(Learned(R.string.objectives_autosens_learned)) ) } diff --git a/plugins/constraints/src/main/kotlin/app/aaps/plugins/constraints/objectives/objectives/Objective9.kt b/plugins/constraints/src/main/kotlin/app/aaps/plugins/constraints/objectives/objectives/Objective9.kt index dd623d4f37..d350afdd47 100644 --- a/plugins/constraints/src/main/kotlin/app/aaps/plugins/constraints/objectives/objectives/Objective9.kt +++ b/plugins/constraints/src/main/kotlin/app/aaps/plugins/constraints/objectives/objectives/Objective9.kt @@ -8,7 +8,7 @@ class Objective9(injector: HasAndroidInjector) : Objective(injector, "smb", R.st init { tasks.add( - MinimumDurationTask(this, T.days(28).msecs()) + MinimumDurationTask(this, T.mins(28).msecs()) .learned(Learned(R.string.objectives_smb_learned)) ) }