From 46793abbfc5db7a6bc011615d48efed283b0a96b Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Thu, 1 Apr 2021 18:14:31 +0200 Subject: [PATCH] Treatment cleanup --- .../tidepool/elements/WizardElement.kt | 3 +- .../plugins/insulin/ActivityGraph.kt | 3 +- .../androidaps/TestBaseWithProfile.kt | 7 ---- .../insulin/InsulinOrefBasePluginTest.kt | 37 ++++++++----------- .../androidaps/queue/CommandQueueTest.kt | 3 +- .../general/automation/TestBaseWithProfile.kt | 7 ---- .../triggers/TriggerBolusAgoTest.kt | 6 +-- .../androidaps/data/DetailedBolusInfo.kt | 3 +- .../nightscout/androidaps/db/Treatment.java | 1 + .../plugins/pump/PumpSyncImplementation.kt | 9 ++--- .../utils/extensions/BolusExtension.kt | 3 +- .../androidaps/TestBaseWithProfile.kt | 7 ---- .../androidaps/TestBaseWithProfile.kt | 7 ---- .../androidaps/TestBaseWithProfile.kt | 7 ---- .../androidaps/TestBaseWithProfile.kt | 7 ---- .../DanaRSPacketNotifyDeliveryCompleteTest.kt | 7 ---- .../DanaRsPacketBolusSetStepBolusStopTest.kt | 7 ---- ...naRsPacketNotifyDeliveryRateDisplayTest.kt | 7 ---- .../androidaps/database/entities/Bolus.kt | 2 +- 19 files changed, 28 insertions(+), 105 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/tidepool/elements/WizardElement.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/tidepool/elements/WizardElement.kt index dc498d573b..cb5c0c2136 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/tidepool/elements/WizardElement.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/tidepool/elements/WizardElement.kt @@ -19,8 +19,7 @@ class WizardElement(carbs: Carbs) val fake = Bolus( amount = 0.0001, timestamp = carbs.timestamp, - type = Bolus.Type.NORMAL, - isBasalInsulin = false + type = Bolus.Type.NORMAL ) bolus = BolusElement(fake) // fake insulin record } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/insulin/ActivityGraph.kt b/app/src/main/java/info/nightscout/androidaps/plugins/insulin/ActivityGraph.kt index 236269fb69..04f58c299e 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/insulin/ActivityGraph.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/insulin/ActivityGraph.kt @@ -25,8 +25,7 @@ class ActivityGraph : GraphView { val bolus = Bolus( timestamp = 0, amount = 1.0, - type = Bolus.Type.NORMAL, - isBasalInsulin = false + type = Bolus.Type.NORMAL ) val activityArray: MutableList = ArrayList() val iobArray: MutableList = ArrayList() diff --git a/app/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt b/app/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt index e3e5c7391b..be4e29d439 100644 --- a/app/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt +++ b/app/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt @@ -4,7 +4,6 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.data.Profile import info.nightscout.androidaps.db.ProfileSwitch -import info.nightscout.androidaps.db.Treatment import info.nightscout.androidaps.interfaces.ActivePluginProvider import info.nightscout.androidaps.interfaces.ConfigInterface import info.nightscout.androidaps.interfaces.ProfileFunction @@ -52,12 +51,6 @@ open class TestBaseWithProfile : TestBase() { it.resourceHelper = resourceHelper it.dateUtil = dateUtil } - if (it is Treatment) { - it.activePlugin = activePluginProvider - it.profileFunction = profileFunction - it.defaultValueHelper = defaultValueHelper - it.resourceHelper = resourceHelper - } } } diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefBasePluginTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefBasePluginTest.kt index 6558ed80be..a7a5fe01fe 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefBasePluginTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefBasePluginTest.kt @@ -4,13 +4,13 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.Constants import info.nightscout.androidaps.data.Iob +import info.nightscout.androidaps.database.entities.Bolus import info.nightscout.androidaps.interfaces.ActivePluginProvider +import info.nightscout.androidaps.interfaces.InsulinInterface +import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.plugins.bus.RxBusWrapper -import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.plugins.insulin.InsulinOrefBasePlugin.Companion.MIN_DIA -import info.nightscout.androidaps.db.Treatment -import info.nightscout.androidaps.interfaces.InsulinInterface import info.nightscout.androidaps.utils.DefaultValueHelper import info.nightscout.androidaps.utils.resources.ResourceHelper import org.json.JSONObject @@ -69,12 +69,6 @@ class InsulinOrefBasePluginTest { private var injector: HasAndroidInjector = HasAndroidInjector { AndroidInjector { - if (it is Treatment) { - it.defaultValueHelper = defaultValueHelper - it.resourceHelper = resourceHelper - it.profileFunction = profileFunction - it.activePlugin = activePlugin - } } } @@ -100,31 +94,32 @@ class InsulinOrefBasePluginTest { @Test fun testIobCalcForTreatment() { - val treatment = Treatment(injector) //TODO: this should be a separate sut. I'd prefer a separate class. + val treatment = Bolus(timestamp = 0, amount = 10.0, type = Bolus.Type.NORMAL) val expected = Iob() - Assert.assertEquals(expected, sut.iobCalcForTreatment(treatment, 0, 0.0)) + Assert.assertEquals(expected.iobContrib, sut.iobCalcForTreatment(treatment, 0, 0.0).iobContrib, 0.001) + Assert.assertEquals(expected.activityContrib, sut.iobCalcForTreatment(treatment, 0, 0.0).activityContrib, 0.001) testPeak = 30 testUserDefinedDia = 4.0 val time = System.currentTimeMillis() // check directly after bolus - treatment.date = time - treatment.insulin = 10.0 + treatment.timestamp = time + treatment.amount = 10.0 Assert.assertEquals(10.0, sut.iobCalcForTreatment(treatment, time, Constants.defaultDIA).iobContrib, 0.1) // check after 1 hour - treatment.date = time - 1 * 60 * 60 * 1000 // 1 hour - treatment.insulin = 10.0 + treatment.timestamp = time - 1 * 60 * 60 * 1000 // 1 hour + treatment.amount = 10.0 Assert.assertEquals(3.92, sut.iobCalcForTreatment(treatment, time, Constants.defaultDIA).iobContrib, 0.1) // check after 2 hour - treatment.date = time - 2 * 60 * 60 * 1000 // 1 hour - treatment.insulin = 10.0 + treatment.timestamp = time - 2 * 60 * 60 * 1000 // 2 hours + treatment.amount = 10.0 Assert.assertEquals(0.77, sut.iobCalcForTreatment(treatment, time, Constants.defaultDIA).iobContrib, 0.1) // check after 3 hour - treatment.date = time - 3 * 60 * 60 * 1000 // 1 hour - treatment.insulin = 10.0 + treatment.timestamp = time - 3 * 60 * 60 * 1000 // 3 hours + treatment.amount = 10.0 Assert.assertEquals(0.10, sut.iobCalcForTreatment(treatment, time, Constants.defaultDIA).iobContrib, 0.1) // check after dia - treatment.date = time - 4 * 60 * 60 * 1000 - treatment.insulin = 10.0 + treatment.timestamp = time - 4 * 60 * 60 * 1000 // 4 hours + treatment.amount = 10.0 Assert.assertEquals(0.0, sut.iobCalcForTreatment(treatment, time, Constants.defaultDIA).iobContrib, 0.1) } } \ No newline at end of file diff --git a/app/src/test/java/info/nightscout/androidaps/queue/CommandQueueTest.kt b/app/src/test/java/info/nightscout/androidaps/queue/CommandQueueTest.kt index deb93405f0..b07c724aab 100644 --- a/app/src/test/java/info/nightscout/androidaps/queue/CommandQueueTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/queue/CommandQueueTest.kt @@ -119,8 +119,7 @@ class CommandQueueTest : TestBaseWithProfile() { Bolus( timestamp = Calendar.getInstance().also { it.set(2000, 0, 1) }.timeInMillis, type = Bolus.Type.NORMAL, - amount = 0.0, - isBasalInsulin = false + amount = 0.0 ) ) `when`(profileFunction.getProfile()).thenReturn(validProfile) diff --git a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/TestBaseWithProfile.kt b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/TestBaseWithProfile.kt index 50936b666b..9e8dd75a1a 100644 --- a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/TestBaseWithProfile.kt +++ b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/TestBaseWithProfile.kt @@ -5,7 +5,6 @@ import dagger.android.HasAndroidInjector import info.nightscout.androidaps.data.Profile import info.nightscout.androidaps.database.AppRepository import info.nightscout.androidaps.db.ProfileSwitch -import info.nightscout.androidaps.db.Treatment import info.nightscout.androidaps.interfaces.ActivePluginProvider import info.nightscout.androidaps.interfaces.ConfigInterface import info.nightscout.androidaps.interfaces.ProfileFunction @@ -54,12 +53,6 @@ open class TestBaseWithProfile : TestBase() { it.resourceHelper = resourceHelper it.dateUtil = dateUtil } - if (it is Treatment) { - it.activePlugin = activePluginProvider - it.profileFunction = profileFunction - it.defaultValueHelper = defaultValueHelper - it.resourceHelper = resourceHelper - } } } diff --git a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerBolusAgoTest.kt b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerBolusAgoTest.kt index 1d27750569..2fbb9ec97f 100644 --- a/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerBolusAgoTest.kt +++ b/automation/src/test/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerBolusAgoTest.kt @@ -34,8 +34,7 @@ class TriggerBolusAgoTest : TriggerTestBase() { Bolus( timestamp = now, amount = 0.0, - type = Bolus.Type.NORMAL, - isBasalInsulin = false + type = Bolus.Type.NORMAL ) ) // Set last bolus time to now `when`(dateUtil._now()).thenReturn(now + 10 * 60 * 1000) // set current time to now + 10 min @@ -64,8 +63,7 @@ class TriggerBolusAgoTest : TriggerTestBase() { Bolus( timestamp = 0L, amount = 0.0, - type = Bolus.Type.NORMAL, - isBasalInsulin = false + type = Bolus.Type.NORMAL ) ) // Set last bolus time to 0 t = TriggerBolusAgo(injector).comparator(Comparator.Compare.IS_NOT_AVAILABLE) diff --git a/core/src/main/java/info/nightscout/androidaps/data/DetailedBolusInfo.kt b/core/src/main/java/info/nightscout/androidaps/data/DetailedBolusInfo.kt index 06e15429bd..c9d31cd18a 100644 --- a/core/src/main/java/info/nightscout/androidaps/data/DetailedBolusInfo.kt +++ b/core/src/main/java/info/nightscout/androidaps/data/DetailedBolusInfo.kt @@ -106,8 +106,7 @@ class DetailedBolusInfo { Bolus( timestamp = bolusTimestamp ?: timestamp, amount = insulin, - type = bolusType.toDBbBolusType(), - isBasalInsulin = false + type = bolusType.toDBbBolusType() ) else null diff --git a/core/src/main/java/info/nightscout/androidaps/db/Treatment.java b/core/src/main/java/info/nightscout/androidaps/db/Treatment.java index 550de2b38a..ddf85afcab 100644 --- a/core/src/main/java/info/nightscout/androidaps/db/Treatment.java +++ b/core/src/main/java/info/nightscout/androidaps/db/Treatment.java @@ -32,6 +32,7 @@ import info.nightscout.androidaps.utils.DefaultValueHelper; import info.nightscout.androidaps.utils.JsonHelper; import info.nightscout.androidaps.utils.resources.ResourceHelper; +@Deprecated @DatabaseTable(tableName = Treatment.TABLE_TREATMENTS) public class Treatment implements DataPointWithLabelInterface, DbObjectBase { @Inject public DefaultValueHelper defaultValueHelper; diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/pump/PumpSyncImplementation.kt b/core/src/main/java/info/nightscout/androidaps/plugins/pump/PumpSyncImplementation.kt index bf8d383274..86c92742ab 100644 --- a/core/src/main/java/info/nightscout/androidaps/plugins/pump/PumpSyncImplementation.kt +++ b/core/src/main/java/info/nightscout/androidaps/plugins/pump/PumpSyncImplementation.kt @@ -31,8 +31,7 @@ class PumpSyncImplementation @Inject constructor( temporaryId = temporaryId, pumpType = pumpType.toDbPumpType(), pumpSerial = pumpSerial - ), - isBasalInsulin = false + ) ) repository.runTransactionForResult(InsertPumpBolusWithTempIdTransaction(bolus)) .doOnError { aapsLogger.error(LTag.DATABASE, "Error while saving carbs", it) } @@ -53,8 +52,7 @@ class PumpSyncImplementation @Inject constructor( pumpId = pumpId, pumpType = pumpType.toDbPumpType(), pumpSerial = pumpSerial - ), - isBasalInsulin = false + ) ) repository.runTransactionForResult(SyncPumpBolusWithTempIdTransaction(bolus, type?.toDBbBolusType())) .doOnError { aapsLogger.error(LTag.DATABASE, "Error while saving carbs", it) } @@ -74,8 +72,7 @@ class PumpSyncImplementation @Inject constructor( pumpId = pumpId, pumpType = pumpType.toDbPumpType(), pumpSerial = pumpSerial - ), - isBasalInsulin = false + ) ) repository.runTransactionForResult(SyncPumpBolusTransaction(bolus, type?.toDBbBolusType())) .doOnError { aapsLogger.error(LTag.DATABASE, "Error while saving carbs", it) } diff --git a/core/src/main/java/info/nightscout/androidaps/utils/extensions/BolusExtension.kt b/core/src/main/java/info/nightscout/androidaps/utils/extensions/BolusExtension.kt index 61c122de28..48ba4fb21e 100644 --- a/core/src/main/java/info/nightscout/androidaps/utils/extensions/BolusExtension.kt +++ b/core/src/main/java/info/nightscout/androidaps/utils/extensions/BolusExtension.kt @@ -57,8 +57,7 @@ fun bolusFromJson(jsonObject: JSONObject): Bolus? { timestamp = timestamp, amount = amount, type = type, - isValid = isValid, - isBasalInsulin = false + isValid = isValid ).also { it.interfaceIDs.nightscoutId = id it.interfaceIDs.pumpId = pumpId diff --git a/core/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt b/core/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt index e3e5c7391b..be4e29d439 100644 --- a/core/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt +++ b/core/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt @@ -4,7 +4,6 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.data.Profile import info.nightscout.androidaps.db.ProfileSwitch -import info.nightscout.androidaps.db.Treatment import info.nightscout.androidaps.interfaces.ActivePluginProvider import info.nightscout.androidaps.interfaces.ConfigInterface import info.nightscout.androidaps.interfaces.ProfileFunction @@ -52,12 +51,6 @@ open class TestBaseWithProfile : TestBase() { it.resourceHelper = resourceHelper it.dateUtil = dateUtil } - if (it is Treatment) { - it.activePlugin = activePluginProvider - it.profileFunction = profileFunction - it.defaultValueHelper = defaultValueHelper - it.resourceHelper = resourceHelper - } } } diff --git a/dana/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt b/dana/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt index e3e5c7391b..be4e29d439 100644 --- a/dana/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt +++ b/dana/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt @@ -4,7 +4,6 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.data.Profile import info.nightscout.androidaps.db.ProfileSwitch -import info.nightscout.androidaps.db.Treatment import info.nightscout.androidaps.interfaces.ActivePluginProvider import info.nightscout.androidaps.interfaces.ConfigInterface import info.nightscout.androidaps.interfaces.ProfileFunction @@ -52,12 +51,6 @@ open class TestBaseWithProfile : TestBase() { it.resourceHelper = resourceHelper it.dateUtil = dateUtil } - if (it is Treatment) { - it.activePlugin = activePluginProvider - it.profileFunction = profileFunction - it.defaultValueHelper = defaultValueHelper - it.resourceHelper = resourceHelper - } } } diff --git a/danar/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt b/danar/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt index e3e5c7391b..be4e29d439 100644 --- a/danar/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt +++ b/danar/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt @@ -4,7 +4,6 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.data.Profile import info.nightscout.androidaps.db.ProfileSwitch -import info.nightscout.androidaps.db.Treatment import info.nightscout.androidaps.interfaces.ActivePluginProvider import info.nightscout.androidaps.interfaces.ConfigInterface import info.nightscout.androidaps.interfaces.ProfileFunction @@ -52,12 +51,6 @@ open class TestBaseWithProfile : TestBase() { it.resourceHelper = resourceHelper it.dateUtil = dateUtil } - if (it is Treatment) { - it.activePlugin = activePluginProvider - it.profileFunction = profileFunction - it.defaultValueHelper = defaultValueHelper - it.resourceHelper = resourceHelper - } } } diff --git a/danars/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt b/danars/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt index e3e5c7391b..be4e29d439 100644 --- a/danars/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt +++ b/danars/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt @@ -4,7 +4,6 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.data.Profile import info.nightscout.androidaps.db.ProfileSwitch -import info.nightscout.androidaps.db.Treatment import info.nightscout.androidaps.interfaces.ActivePluginProvider import info.nightscout.androidaps.interfaces.ConfigInterface import info.nightscout.androidaps.interfaces.ProfileFunction @@ -52,12 +51,6 @@ open class TestBaseWithProfile : TestBase() { it.resourceHelper = resourceHelper it.dateUtil = dateUtil } - if (it is Treatment) { - it.activePlugin = activePluginProvider - it.profileFunction = profileFunction - it.defaultValueHelper = defaultValueHelper - it.resourceHelper = resourceHelper - } } } diff --git a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRSPacketNotifyDeliveryCompleteTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRSPacketNotifyDeliveryCompleteTest.kt index 1b2ef69411..556d3bf7c1 100644 --- a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRSPacketNotifyDeliveryCompleteTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRSPacketNotifyDeliveryCompleteTest.kt @@ -4,7 +4,6 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.danars.DanaRSPlugin import info.nightscout.androidaps.danars.DanaRSTestBase -import info.nightscout.androidaps.db.Treatment import info.nightscout.androidaps.interfaces.ActivePluginProvider import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewBolusProgress @@ -32,12 +31,6 @@ class DanaRSPacketNotifyDeliveryCompleteTest : DanaRSTestBase() { it.resourceHelper = resourceHelper it.danaPump = danaPump } - if (it is Treatment) { - it.defaultValueHelper = defaultValueHelper - it.resourceHelper = resourceHelper - it.profileFunction = profileFunction - it.activePlugin = activePlugin - } } } diff --git a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusSetStepBolusStopTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusSetStepBolusStopTest.kt index 128f02bd0b..f8d583c27c 100644 --- a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusSetStepBolusStopTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketBolusSetStepBolusStopTest.kt @@ -4,7 +4,6 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.danars.DanaRSPlugin import info.nightscout.androidaps.danars.DanaRSTestBase -import info.nightscout.androidaps.db.Treatment import info.nightscout.androidaps.interfaces.ActivePluginProvider import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewBolusProgress @@ -31,12 +30,6 @@ class DanaRsPacketBolusSetStepBolusStopTest : DanaRSTestBase() { it.resourceHelper = resourceHelper it.danaPump = danaPump } - if (it is Treatment) { - it.defaultValueHelper = defaultValueHelper - it.resourceHelper = resourceHelper - it.profileFunction = profileFunction - it.activePlugin = activePlugin - } } } diff --git a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketNotifyDeliveryRateDisplayTest.kt b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketNotifyDeliveryRateDisplayTest.kt index 61413466dd..1c24195165 100644 --- a/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketNotifyDeliveryRateDisplayTest.kt +++ b/danars/src/test/java/info/nightscout/androidaps/danars/comm/DanaRsPacketNotifyDeliveryRateDisplayTest.kt @@ -5,7 +5,6 @@ import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.danars.DanaRSPlugin import info.nightscout.androidaps.danars.DanaRSTestBase -import info.nightscout.androidaps.db.Treatment import info.nightscout.androidaps.interfaces.ActivePluginProvider import info.nightscout.androidaps.interfaces.CommandQueueProvider import info.nightscout.androidaps.plugins.bus.RxBusWrapper @@ -42,12 +41,6 @@ class DanaRsPacketNotifyDeliveryRateDisplayTest : DanaRSTestBase() { it.resourceHelper = resourceHelper it.danaPump = danaPump } - if (it is Treatment) { - it.defaultValueHelper = defaultValueHelper - it.resourceHelper = resourceHelper - it.profileFunction = profileFunction - it.activePlugin = activePlugin - } } } diff --git a/database/src/main/java/info/nightscout/androidaps/database/entities/Bolus.kt b/database/src/main/java/info/nightscout/androidaps/database/entities/Bolus.kt index b85f1aabe8..afc6108867 100644 --- a/database/src/main/java/info/nightscout/androidaps/database/entities/Bolus.kt +++ b/database/src/main/java/info/nightscout/androidaps/database/entities/Bolus.kt @@ -32,7 +32,7 @@ data class Bolus( override var utcOffset: Long = TimeZone.getDefault().getOffset(timestamp).toLong(), var amount: Double, var type: Type, - var isBasalInsulin: Boolean, + var isBasalInsulin: Boolean = false, @Embedded var insulinConfiguration: InsulinConfiguration? = null ) : TraceableDBEntry, DBEntryWithTime {