Autotune Fix Conflicts after dev merge

This commit is contained in:
Philoul 2022-11-14 09:32:02 +01:00
parent 35461bfdd8
commit e201ff256f
5 changed files with 9 additions and 15 deletions

View file

@ -11,7 +11,6 @@ import info.nightscout.automation.elements.LabelWithElement
import info.nightscout.automation.elements.LayoutBuilder
import info.nightscout.interfaces.autotune.Autotune
import info.nightscout.interfaces.plugin.ActivePlugin
import info.nightscout.androidaps.plugins.general.automation.elements.InputWeekDay
import info.nightscout.interfaces.profile.ProfileFunction
import info.nightscout.interfaces.pump.PumpEnactResult
import info.nightscout.interfaces.queue.Callback

View file

@ -4,7 +4,8 @@ import android.widget.LinearLayout
import androidx.annotation.StringRes
import info.nightscout.automation.ui.WeekdayPicker
import info.nightscout.automation.R
import java.util.Calendar
import java.util.*
import kotlin.collections.ArrayList
class InputWeekDay : Element() {
@ -67,7 +68,7 @@ class InputWeekDay : Element() {
fun isSet(timestamp: Long): Boolean {
val scheduledDayOfWeek = Calendar.getInstance().also { it.time = Date(timestamp) }
return isSet(Objects.requireNonNull(DayOfWeek.fromCalendarInt(scheduledDayOfWeek[Calendar.DAY_OF_WEEK])))
return isSet(DayOfWeek.fromCalendarInt(scheduledDayOfWeek[Calendar.DAY_OF_WEEK]))
}
fun getSelectedDays(): List<Int> {

View file

@ -53,4 +53,5 @@ dependencies {
// Overview
api 'com.google.android.flexbox:flexbox:3.0.0'
implementation project(path: ':automation')
}

View file

@ -21,16 +21,8 @@ import dagger.android.HasAndroidInjector
import dagger.android.support.DaggerFragment
import info.nightscout.androidaps.data.ProfileSealed
import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.plugins.bus.RxBus
import info.nightscout.androidaps.plugins.general.autotune.data.ATProfile
import info.nightscout.androidaps.plugins.general.autotune.events.EventAutotuneUpdateGui
import info.nightscout.androidaps.plugins.profile.local.LocalProfilePlugin
import info.nightscout.androidaps.plugins.profile.local.events.EventLocalProfileChanged
import info.nightscout.androidaps.utils.DateUtil
import info.nightscout.androidaps.utils.FabricPrivacy
import info.nightscout.androidaps.utils.MidnightTime
import info.nightscout.androidaps.utils.Round
import info.nightscout.androidaps.utils.alertDialogs.OKDialog.showConfirmation
import info.nightscout.automation.elements.InputWeekDay
import info.nightscout.core.fabric.FabricPrivacy
import info.nightscout.core.profile.ProfileStoreObject
import info.nightscout.core.profile.fromMgdlToUnits

View file

@ -5,10 +5,10 @@ import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.data.ProfileSealed
import info.nightscout.androidaps.extensions.pureProfileFromJson
import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.automation.elements.InputWeekDay
import info.nightscout.core.profile.ProfileStoreObject
import info.nightscout.database.entities.UserEntry
import info.nightscout.database.entities.ValueWithUnit
import info.nightscout.androidaps.plugins.general.automation.elements.InputWeekDay
import info.nightscout.interfaces.BuildHelper
import info.nightscout.interfaces.autotune.Autotune
import info.nightscout.interfaces.insulin.Insulin
@ -36,9 +36,10 @@ import info.nightscout.shared.utils.DateUtil
import info.nightscout.shared.utils.T
import org.json.JSONException
import org.json.JSONObject
import java.util.TimeZone
import java.util.*
import javax.inject.Inject
import javax.inject.Singleton
import kotlin.collections.ArrayList
/*
* adaptation from oref0 autotune developed by philoul on 2022 (complete refactoring of AutotunePlugin initialised by Rumen Georgiev on 1/29/2018.)
@ -107,7 +108,7 @@ class AutotunePlugin @Inject constructor(
var counter = 0
for (i in days.getSelectedDays()) {
if (counter++ > 0) sb.append(",")
sb.append(Objects.requireNonNull(InputWeekDay.DayOfWeek.fromCalendarInt(i)))
sb.append(InputWeekDay.DayOfWeek.fromCalendarInt(i))
}
log(sb.toString())
tunedProfile = null