From 82cce81d0bfbd018aeccb8a10e85e86d7a1eefa5 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Fri, 28 May 2021 08:59:52 +0200 Subject: [PATCH] update duration requirement --- .../nightscout/androidaps/database/entities/TemporaryBasal.kt | 3 +-- .../database/interfaces/DBEntryWithTimeAndDuration.kt | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/database/src/main/java/info/nightscout/androidaps/database/entities/TemporaryBasal.kt b/database/src/main/java/info/nightscout/androidaps/database/entities/TemporaryBasal.kt index 2e3b002476..14d1b876e6 100644 --- a/database/src/main/java/info/nightscout/androidaps/database/entities/TemporaryBasal.kt +++ b/database/src/main/java/info/nightscout/androidaps/database/entities/TemporaryBasal.kt @@ -45,8 +45,7 @@ data class TemporaryBasal( ) : TraceableDBEntry, DBEntryWithTimeAndDuration { init { - if (duration <= 0) - require(duration > 0) + require(duration > 0) } enum class Type { diff --git a/database/src/main/java/info/nightscout/androidaps/database/interfaces/DBEntryWithTimeAndDuration.kt b/database/src/main/java/info/nightscout/androidaps/database/interfaces/DBEntryWithTimeAndDuration.kt index b4f3f0bbbf..01f41c7f3f 100644 --- a/database/src/main/java/info/nightscout/androidaps/database/interfaces/DBEntryWithTimeAndDuration.kt +++ b/database/src/main/java/info/nightscout/androidaps/database/interfaces/DBEntryWithTimeAndDuration.kt @@ -8,6 +8,7 @@ var DBEntryWithTimeAndDuration.end get() = timestamp + duration set(value) { duration = value - timestamp + require(duration > 0) } @JvmOverloads