commit
3c2d4cc126
18 changed files with 3666 additions and 18 deletions
|
@ -270,6 +270,10 @@ class TreatmentsBolusCarbsFragment : DaggerFragment(), MenuProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
holder.binding.calculation.tag = ml
|
holder.binding.calculation.tag = ml
|
||||||
|
|
||||||
|
var notes = ml.carbs?.notes ?: ml.bolus?.notes ?: ""
|
||||||
|
holder.binding.notes.text = notes
|
||||||
|
holder.binding.notes.visibility = if (notes != "") View.VISIBLE else View.GONE
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getItemCount() = mealLinks.size
|
override fun getItemCount() = mealLinks.size
|
||||||
|
|
|
@ -88,7 +88,7 @@ class NSClientAddUpdateWorker(
|
||||||
.also { result ->
|
.also { result ->
|
||||||
result.inserted.forEach {
|
result.inserted.forEach {
|
||||||
uel.log(
|
uel.log(
|
||||||
Action.BOLUS, Sources.NSClient,
|
Action.BOLUS, Sources.NSClient, it.notes,
|
||||||
ValueWithUnit.Timestamp(it.timestamp),
|
ValueWithUnit.Timestamp(it.timestamp),
|
||||||
ValueWithUnit.Insulin(it.amount)
|
ValueWithUnit.Insulin(it.amount)
|
||||||
)
|
)
|
||||||
|
@ -124,7 +124,7 @@ class NSClientAddUpdateWorker(
|
||||||
.also { result ->
|
.also { result ->
|
||||||
result.inserted.forEach {
|
result.inserted.forEach {
|
||||||
uel.log(
|
uel.log(
|
||||||
Action.CARBS, Sources.NSClient,
|
Action.CARBS, Sources.NSClient, it.notes,
|
||||||
ValueWithUnit.Timestamp(it.timestamp),
|
ValueWithUnit.Timestamp(it.timestamp),
|
||||||
ValueWithUnit.Gram(it.amount.toInt())
|
ValueWithUnit.Gram(it.amount.toInt())
|
||||||
)
|
)
|
||||||
|
@ -140,7 +140,7 @@ class NSClientAddUpdateWorker(
|
||||||
}
|
}
|
||||||
result.updated.forEach {
|
result.updated.forEach {
|
||||||
uel.log(
|
uel.log(
|
||||||
Action.CARBS, Sources.NSClient,
|
Action.CARBS, Sources.NSClient, it.notes,
|
||||||
ValueWithUnit.Timestamp(it.timestamp),
|
ValueWithUnit.Timestamp(it.timestamp),
|
||||||
ValueWithUnit.Gram(it.amount.toInt())
|
ValueWithUnit.Gram(it.amount.toInt())
|
||||||
)
|
)
|
||||||
|
|
|
@ -544,7 +544,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
|
||||||
|
|
||||||
// **** Various treatment buttons ****
|
// **** Various treatment buttons ****
|
||||||
binding.buttonsLayout.carbsButton.visibility =
|
binding.buttonsLayout.carbsButton.visibility =
|
||||||
((!activePlugin.activePump.pumpDescription.storesCarbInfo || pump.isInitialized() && !pump.isSuspended()) && profile != null
|
(/*(!activePlugin.activePump.pumpDescription.storesCarbInfo || pump.isInitialized() && !pump.isSuspended()) &&*/ profile != null
|
||||||
&& sp.getBoolean(R.string.key_show_carbs_button, true)).toVisibility()
|
&& sp.getBoolean(R.string.key_show_carbs_button, true)).toVisibility()
|
||||||
binding.buttonsLayout.treatmentButton.visibility = (!loop.isDisconnected && pump.isInitialized() && !pump.isSuspended() && profile != null
|
binding.buttonsLayout.treatmentButton.visibility = (!loop.isDisconnected && pump.isInitialized() && !pump.isSuspended() && profile != null
|
||||||
&& sp.getBoolean(R.string.key_show_treatment_button, false)).toVisibility()
|
&& sp.getBoolean(R.string.key_show_treatment_button, false)).toVisibility()
|
||||||
|
|
|
@ -91,7 +91,7 @@ open class VirtualPumpPlugin @Inject constructor(
|
||||||
it.basalStep = 0.01
|
it.basalStep = 0.01
|
||||||
it.basalMinimumRate = 0.01
|
it.basalMinimumRate = 0.01
|
||||||
it.isRefillingCapable = true
|
it.isRefillingCapable = true
|
||||||
it.storesCarbInfo = false
|
//it.storesCarbInfo = false
|
||||||
it.is30minBasalRatesCapable = true
|
it.is30minBasalRatesCapable = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -232,10 +232,10 @@ class CommandQueueImplementation @Inject constructor(
|
||||||
|
|
||||||
var carbsRunnable = Runnable { }
|
var carbsRunnable = Runnable { }
|
||||||
val originalCarbs = detailedBolusInfo.carbs
|
val originalCarbs = detailedBolusInfo.carbs
|
||||||
if ((detailedBolusInfo.carbs > 0) &&
|
if ((detailedBolusInfo.carbs > 0) /*&&
|
||||||
(!activePlugin.activePump.pumpDescription.storesCarbInfo ||
|
(!activePlugin.activePump.pumpDescription.storesCarbInfo ||
|
||||||
detailedBolusInfo.carbsDuration != 0L ||
|
detailedBolusInfo.carbsDuration != 0L ||
|
||||||
(detailedBolusInfo.carbsTimestamp ?: detailedBolusInfo.timestamp) > dateUtil.now())
|
(detailedBolusInfo.carbsTimestamp ?: detailedBolusInfo.timestamp) > dateUtil.now())*/
|
||||||
) {
|
) {
|
||||||
carbsRunnable = Runnable {
|
carbsRunnable = Runnable {
|
||||||
aapsLogger.debug(LTag.PUMPQUEUE, "Going to store carbs")
|
aapsLogger.debug(LTag.PUMPQUEUE, "Going to store carbs")
|
||||||
|
|
|
@ -271,6 +271,16 @@
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/notes"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingStart="20dp"
|
||||||
|
android:paddingEnd="10dp"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
|
tools:ignore="RtlSymmetry"
|
||||||
|
tools:text="Notes" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</com.google.android.material.card.MaterialCardView>
|
</com.google.android.material.card.MaterialCardView>
|
||||||
|
|
|
@ -107,7 +107,8 @@ class DetailedBolusInfo {
|
||||||
Bolus(
|
Bolus(
|
||||||
timestamp = bolusTimestamp ?: timestamp,
|
timestamp = bolusTimestamp ?: timestamp,
|
||||||
amount = insulin,
|
amount = insulin,
|
||||||
type = bolusType.toDBbBolusType()
|
type = bolusType.toDBbBolusType(),
|
||||||
|
notes = notes,
|
||||||
)
|
)
|
||||||
else null
|
else null
|
||||||
|
|
||||||
|
@ -116,7 +117,8 @@ class DetailedBolusInfo {
|
||||||
Carbs(
|
Carbs(
|
||||||
timestamp = carbsTimestamp ?: timestamp,
|
timestamp = carbsTimestamp ?: timestamp,
|
||||||
amount = carbs,
|
amount = carbs,
|
||||||
duration = carbsDuration
|
duration = carbsDuration,
|
||||||
|
notes = notes,
|
||||||
)
|
)
|
||||||
else null
|
else null
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@ fun Bolus.toJson(isAdd: Boolean, dateUtil: DateUtil): JSONObject =
|
||||||
.put("created_at", dateUtil.toISOString(timestamp))
|
.put("created_at", dateUtil.toISOString(timestamp))
|
||||||
.put("date", timestamp)
|
.put("date", timestamp)
|
||||||
.put("type", type.name)
|
.put("type", type.name)
|
||||||
|
.put("notes", notes)
|
||||||
.put("isValid", isValid)
|
.put("isValid", isValid)
|
||||||
.put("isSMB", type == Bolus.Type.SMB).also {
|
.put("isSMB", type == Bolus.Type.SMB).also {
|
||||||
if (interfaceIDs.pumpId != null) it.put("pumpId", interfaceIDs.pumpId)
|
if (interfaceIDs.pumpId != null) it.put("pumpId", interfaceIDs.pumpId)
|
||||||
|
@ -55,6 +56,7 @@ fun bolusFromJson(jsonObject: JSONObject): Bolus? {
|
||||||
val amount = JsonHelper.safeGetDoubleAllowNull(jsonObject, "insulin") ?: return null
|
val amount = JsonHelper.safeGetDoubleAllowNull(jsonObject, "insulin") ?: return null
|
||||||
val type = Bolus.Type.fromString(JsonHelper.safeGetString(jsonObject, "type"))
|
val type = Bolus.Type.fromString(JsonHelper.safeGetString(jsonObject, "type"))
|
||||||
val isValid = JsonHelper.safeGetBoolean(jsonObject, "isValid", true)
|
val isValid = JsonHelper.safeGetBoolean(jsonObject, "isValid", true)
|
||||||
|
val notes = JsonHelper.safeGetStringAllowNull(jsonObject, "notes", null)
|
||||||
val id = JsonHelper.safeGetStringAllowNull(jsonObject, "_id", null) ?: return null
|
val id = JsonHelper.safeGetStringAllowNull(jsonObject, "_id", null) ?: return null
|
||||||
val pumpId = JsonHelper.safeGetLongAllowNull(jsonObject, "pumpId", null)
|
val pumpId = JsonHelper.safeGetLongAllowNull(jsonObject, "pumpId", null)
|
||||||
val pumpType = InterfaceIDs.PumpType.fromString(JsonHelper.safeGetStringAllowNull(jsonObject, "pumpType", null))
|
val pumpType = InterfaceIDs.PumpType.fromString(JsonHelper.safeGetStringAllowNull(jsonObject, "pumpType", null))
|
||||||
|
@ -67,7 +69,8 @@ fun bolusFromJson(jsonObject: JSONObject): Bolus? {
|
||||||
timestamp = timestamp,
|
timestamp = timestamp,
|
||||||
amount = amount,
|
amount = amount,
|
||||||
type = type,
|
type = type,
|
||||||
isValid = isValid
|
notes = notes,
|
||||||
|
isValid = isValid,
|
||||||
).also {
|
).also {
|
||||||
it.interfaceIDs.nightscoutId = id
|
it.interfaceIDs.nightscoutId = id
|
||||||
it.interfaceIDs.pumpId = pumpId
|
it.interfaceIDs.pumpId = pumpId
|
||||||
|
|
|
@ -11,6 +11,7 @@ fun Carbs.toJson(isAdd: Boolean, dateUtil: DateUtil): JSONObject =
|
||||||
JSONObject()
|
JSONObject()
|
||||||
.put("eventType", if (amount < 12) TherapyEvent.Type.CARBS_CORRECTION.text else TherapyEvent.Type.MEAL_BOLUS.text)
|
.put("eventType", if (amount < 12) TherapyEvent.Type.CARBS_CORRECTION.text else TherapyEvent.Type.MEAL_BOLUS.text)
|
||||||
.put("carbs", amount)
|
.put("carbs", amount)
|
||||||
|
.put("notes", notes)
|
||||||
.put("created_at", dateUtil.toISOString(timestamp))
|
.put("created_at", dateUtil.toISOString(timestamp))
|
||||||
.put("isValid", isValid)
|
.put("isValid", isValid)
|
||||||
.put("date", timestamp).also {
|
.put("date", timestamp).also {
|
||||||
|
@ -29,6 +30,7 @@ fun carbsFromNsIdForInvalidating(nsId: String): Carbs =
|
||||||
JSONObject()
|
JSONObject()
|
||||||
.put("mills", 1)
|
.put("mills", 1)
|
||||||
.put("carbs", -1.0)
|
.put("carbs", -1.0)
|
||||||
|
.put("notes", null)
|
||||||
.put("_id", nsId)
|
.put("_id", nsId)
|
||||||
.put("isValid", false)
|
.put("isValid", false)
|
||||||
)!!
|
)!!
|
||||||
|
@ -37,6 +39,7 @@ fun carbsFromJson(jsonObject: JSONObject): Carbs? {
|
||||||
val timestamp = JsonHelper.safeGetLongAllowNull(jsonObject, "mills", null) ?: return null
|
val timestamp = JsonHelper.safeGetLongAllowNull(jsonObject, "mills", null) ?: return null
|
||||||
val duration = JsonHelper.safeGetLong(jsonObject, "duration")
|
val duration = JsonHelper.safeGetLong(jsonObject, "duration")
|
||||||
val amount = JsonHelper.safeGetDoubleAllowNull(jsonObject, "carbs") ?: return null
|
val amount = JsonHelper.safeGetDoubleAllowNull(jsonObject, "carbs") ?: return null
|
||||||
|
val notes = JsonHelper.safeGetStringAllowNull(jsonObject, "notes", null)
|
||||||
val isValid = JsonHelper.safeGetBoolean(jsonObject, "isValid", true)
|
val isValid = JsonHelper.safeGetBoolean(jsonObject, "isValid", true)
|
||||||
val id = JsonHelper.safeGetStringAllowNull(jsonObject, "_id", null) ?: return null
|
val id = JsonHelper.safeGetStringAllowNull(jsonObject, "_id", null) ?: return null
|
||||||
val pumpId = JsonHelper.safeGetLongAllowNull(jsonObject, "pumpId", null)
|
val pumpId = JsonHelper.safeGetLongAllowNull(jsonObject, "pumpId", null)
|
||||||
|
@ -50,6 +53,7 @@ fun carbsFromJson(jsonObject: JSONObject): Carbs? {
|
||||||
timestamp = timestamp,
|
timestamp = timestamp,
|
||||||
duration = duration,
|
duration = duration,
|
||||||
amount = amount,
|
amount = amount,
|
||||||
|
notes = notes,
|
||||||
isValid = isValid
|
isValid = isValid
|
||||||
).also {
|
).also {
|
||||||
it.interfaceIDs.nightscoutId = id
|
it.interfaceIDs.nightscoutId = id
|
||||||
|
|
|
@ -33,7 +33,7 @@ class PumpDescription() {
|
||||||
var basalMaximumRate = 0.0
|
var basalMaximumRate = 0.0
|
||||||
var isRefillingCapable = false
|
var isRefillingCapable = false
|
||||||
var isBatteryReplaceable = false
|
var isBatteryReplaceable = false
|
||||||
var storesCarbInfo = false
|
//var storesCarbInfo = false
|
||||||
var is30minBasalRatesCapable = false
|
var is30minBasalRatesCapable = false
|
||||||
var supportsTDDs = false
|
var supportsTDDs = false
|
||||||
var needsManualTDDLoad = false
|
var needsManualTDDLoad = false
|
||||||
|
@ -41,7 +41,7 @@ class PumpDescription() {
|
||||||
var isPatchPump = false
|
var isPatchPump = false
|
||||||
var useHardwareLink = false
|
var useHardwareLink = false
|
||||||
|
|
||||||
fun resetSettings() {
|
private fun resetSettings() {
|
||||||
isBolusCapable = true
|
isBolusCapable = true
|
||||||
bolusStep = 0.1
|
bolusStep = 0.1
|
||||||
isExtendedBolusCapable = true
|
isExtendedBolusCapable = true
|
||||||
|
@ -65,7 +65,7 @@ class PumpDescription() {
|
||||||
is30minBasalRatesCapable = false
|
is30minBasalRatesCapable = false
|
||||||
isRefillingCapable = true
|
isRefillingCapable = true
|
||||||
isBatteryReplaceable = true
|
isBatteryReplaceable = true
|
||||||
storesCarbInfo = false
|
//storesCarbInfo = false
|
||||||
supportsTDDs = false
|
supportsTDDs = false
|
||||||
needsManualTDDLoad = true
|
needsManualTDDLoad = true
|
||||||
hasCustomUnreachableAlertCheck = false
|
hasCustomUnreachableAlertCheck = false
|
||||||
|
@ -101,7 +101,7 @@ class PumpDescription() {
|
||||||
basalMinimumRate = pumpType.baseBasalMinValue
|
basalMinimumRate = pumpType.baseBasalMinValue
|
||||||
isRefillingCapable = pumpCapability.hasCapability(PumpCapability.Refill)
|
isRefillingCapable = pumpCapability.hasCapability(PumpCapability.Refill)
|
||||||
isBatteryReplaceable = pumpCapability.hasCapability(PumpCapability.ReplaceBattery)
|
isBatteryReplaceable = pumpCapability.hasCapability(PumpCapability.ReplaceBattery)
|
||||||
storesCarbInfo = pumpCapability.hasCapability(PumpCapability.StoreCarbInfo)
|
//storesCarbInfo = pumpCapability.hasCapability(PumpCapability.StoreCarbInfo)
|
||||||
supportsTDDs = pumpCapability.hasCapability(PumpCapability.TDD)
|
supportsTDDs = pumpCapability.hasCapability(PumpCapability.TDD)
|
||||||
needsManualTDDLoad = pumpCapability.hasCapability(PumpCapability.ManualTDDLoad)
|
needsManualTDDLoad = pumpCapability.hasCapability(PumpCapability.ManualTDDLoad)
|
||||||
is30minBasalRatesCapable = pumpCapability.hasCapability(PumpCapability.BasalRate30min)
|
is30minBasalRatesCapable = pumpCapability.hasCapability(PumpCapability.BasalRate30min)
|
||||||
|
|
|
@ -8,7 +8,7 @@ enum class PumpCapability {
|
||||||
BasalProfileSet, // isSetBasalProfileCapable
|
BasalProfileSet, // isSetBasalProfileCapable
|
||||||
Refill, // isRefillingCapable
|
Refill, // isRefillingCapable
|
||||||
ReplaceBattery, // isBatteryReplaceable
|
ReplaceBattery, // isBatteryReplaceable
|
||||||
StoreCarbInfo, // storesCarbInfo
|
// StoreCarbInfo, // removed. incompatible with storing notes with carbs
|
||||||
TDD, // supportsTDDs
|
TDD, // supportsTDDs
|
||||||
ManualTDDLoad, // needsManualTDDLoad
|
ManualTDDLoad, // needsManualTDDLoad
|
||||||
BasalRate30min, // is30minBasalRatesCapable
|
BasalRate30min, // is30minBasalRatesCapable
|
||||||
|
@ -18,7 +18,8 @@ enum class PumpCapability {
|
||||||
VirtualPumpCapabilities(arrayOf(Bolus, ExtendedBolus, TempBasal, BasalProfileSet, Refill, ReplaceBattery)),
|
VirtualPumpCapabilities(arrayOf(Bolus, ExtendedBolus, TempBasal, BasalProfileSet, Refill, ReplaceBattery)),
|
||||||
ComboCapabilities(arrayOf(Bolus, TempBasal, BasalProfileSet, Refill, ReplaceBattery, TDD, ManualTDDLoad)),
|
ComboCapabilities(arrayOf(Bolus, TempBasal, BasalProfileSet, Refill, ReplaceBattery, TDD, ManualTDDLoad)),
|
||||||
DanaCapabilities(arrayOf(Bolus, ExtendedBolus, TempBasal, BasalProfileSet, Refill, ReplaceBattery, TDD, ManualTDDLoad)),
|
DanaCapabilities(arrayOf(Bolus, ExtendedBolus, TempBasal, BasalProfileSet, Refill, ReplaceBattery, TDD, ManualTDDLoad)),
|
||||||
DanaWithHistoryCapabilities(arrayOf(Bolus, ExtendedBolus, TempBasal, BasalProfileSet, Refill, ReplaceBattery, StoreCarbInfo, TDD, ManualTDDLoad)),
|
//DanaWithHistoryCapabilities(arrayOf(Bolus, ExtendedBolus, TempBasal, BasalProfileSet, Refill, ReplaceBattery, StoreCarbInfo, TDD, ManualTDDLoad)),
|
||||||
|
DanaWithHistoryCapabilities(arrayOf(Bolus, ExtendedBolus, TempBasal, BasalProfileSet, Refill, ReplaceBattery, TDD, ManualTDDLoad)),
|
||||||
InsightCapabilities(arrayOf(Bolus, ExtendedBolus, TempBasal, BasalProfileSet, Refill, ReplaceBattery, TDD, BasalRate30min)),
|
InsightCapabilities(arrayOf(Bolus, ExtendedBolus, TempBasal, BasalProfileSet, Refill, ReplaceBattery, TDD, BasalRate30min)),
|
||||||
MedtronicCapabilities(arrayOf(Bolus, TempBasal, BasalProfileSet, Refill, ReplaceBattery, TDD)),
|
MedtronicCapabilities(arrayOf(Bolus, TempBasal, BasalProfileSet, Refill, ReplaceBattery, TDD)),
|
||||||
OmnipodCapabilities(arrayOf(Bolus, TempBasal, BasalProfileSet, BasalRate30min)),
|
OmnipodCapabilities(arrayOf(Bolus, TempBasal, BasalProfileSet, BasalRate30min)),
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -6,7 +6,7 @@ import androidx.room.TypeConverters
|
||||||
import info.nightscout.androidaps.database.daos.*
|
import info.nightscout.androidaps.database.daos.*
|
||||||
import info.nightscout.androidaps.database.entities.*
|
import info.nightscout.androidaps.database.entities.*
|
||||||
|
|
||||||
const val DATABASE_VERSION = 21
|
const val DATABASE_VERSION = 22
|
||||||
|
|
||||||
@Database(version = DATABASE_VERSION,
|
@Database(version = DATABASE_VERSION,
|
||||||
entities = [APSResult::class, Bolus::class, BolusCalculatorResult::class, Carbs::class,
|
entities = [APSResult::class, Bolus::class, BolusCalculatorResult::class, Carbs::class,
|
||||||
|
|
|
@ -27,6 +27,7 @@ open class DatabaseModule {
|
||||||
// .addMigrations(migration7to8)
|
// .addMigrations(migration7to8)
|
||||||
// .addMigrations(migration11to12)
|
// .addMigrations(migration11to12)
|
||||||
.addMigrations(migration20to21)
|
.addMigrations(migration20to21)
|
||||||
|
.addMigrations(migration21to22)
|
||||||
.addCallback(object : Callback() {
|
.addCallback(object : Callback() {
|
||||||
override fun onOpen(db: SupportSQLiteDatabase) {
|
override fun onOpen(db: SupportSQLiteDatabase) {
|
||||||
super.onOpen(db)
|
super.onOpen(db)
|
||||||
|
@ -34,6 +35,7 @@ open class DatabaseModule {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.fallbackToDestructiveMigration()
|
.fallbackToDestructiveMigration()
|
||||||
|
.fallbackToDestructiveMigrationOnDowngrade()
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
@Qualifier
|
@Qualifier
|
||||||
|
@ -69,4 +71,13 @@ open class DatabaseModule {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private val migration21to22 = object : Migration(21,22) {
|
||||||
|
override fun migrate(database: SupportSQLiteDatabase) {
|
||||||
|
database.execSQL("ALTER TABLE `carbs` ADD COLUMN `notes` TEXT")
|
||||||
|
database.execSQL("ALTER TABLE `boluses` ADD COLUMN `notes` TEXT")
|
||||||
|
// Custom indexes must be dropped on migration to pass room schema checking after upgrade
|
||||||
|
dropCustomIndexes(database)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -44,6 +44,7 @@ data class Bolus(
|
||||||
override var utcOffset: Long = TimeZone.getDefault().getOffset(timestamp).toLong(),
|
override var utcOffset: Long = TimeZone.getDefault().getOffset(timestamp).toLong(),
|
||||||
var amount: Double,
|
var amount: Double,
|
||||||
var type: Type,
|
var type: Type,
|
||||||
|
var notes: String? = null,
|
||||||
var isBasalInsulin: Boolean = false,
|
var isBasalInsulin: Boolean = false,
|
||||||
@Embedded
|
@Embedded
|
||||||
var insulinConfiguration: InsulinConfiguration? = null
|
var insulinConfiguration: InsulinConfiguration? = null
|
||||||
|
@ -55,6 +56,7 @@ data class Bolus(
|
||||||
utcOffset == other.utcOffset &&
|
utcOffset == other.utcOffset &&
|
||||||
amount == other.amount &&
|
amount == other.amount &&
|
||||||
type == other.type &&
|
type == other.type &&
|
||||||
|
notes == other.notes &&
|
||||||
isBasalInsulin == other.isBasalInsulin
|
isBasalInsulin == other.isBasalInsulin
|
||||||
|
|
||||||
fun onlyNsIdAdded(previous: Bolus): Boolean =
|
fun onlyNsIdAdded(previous: Bolus): Boolean =
|
||||||
|
|
|
@ -35,7 +35,8 @@ data class Carbs(
|
||||||
override var timestamp: Long,
|
override var timestamp: Long,
|
||||||
override var utcOffset: Long = TimeZone.getDefault().getOffset(timestamp).toLong(),
|
override var utcOffset: Long = TimeZone.getDefault().getOffset(timestamp).toLong(),
|
||||||
override var duration: Long, // in milliseconds
|
override var duration: Long, // in milliseconds
|
||||||
var amount: Double
|
var amount: Double,
|
||||||
|
var notes: String? = null
|
||||||
) : TraceableDBEntry, DBEntryWithTimeAndDuration {
|
) : TraceableDBEntry, DBEntryWithTimeAndDuration {
|
||||||
|
|
||||||
private fun contentEqualsTo(other: Carbs): Boolean =
|
private fun contentEqualsTo(other: Carbs): Boolean =
|
||||||
|
@ -43,6 +44,7 @@ data class Carbs(
|
||||||
timestamp == other.timestamp &&
|
timestamp == other.timestamp &&
|
||||||
utcOffset == other.utcOffset &&
|
utcOffset == other.utcOffset &&
|
||||||
amount == other.amount &&
|
amount == other.amount &&
|
||||||
|
notes == other.notes &&
|
||||||
duration == other.duration
|
duration == other.duration
|
||||||
|
|
||||||
fun onlyNsIdAdded(previous: Carbs): Boolean =
|
fun onlyNsIdAdded(previous: Carbs): Boolean =
|
||||||
|
|
|
@ -15,6 +15,7 @@ class InsertOrUpdateBolusTransaction(
|
||||||
timestamp: Long,
|
timestamp: Long,
|
||||||
amount: Double,
|
amount: Double,
|
||||||
type: Bolus.Type,
|
type: Bolus.Type,
|
||||||
|
notes: String? = null,
|
||||||
isBasalInsulin: Boolean = false,
|
isBasalInsulin: Boolean = false,
|
||||||
insulinConfiguration: InsulinConfiguration? = null,
|
insulinConfiguration: InsulinConfiguration? = null,
|
||||||
interfaceIDs_backing: InterfaceIDs? = null
|
interfaceIDs_backing: InterfaceIDs? = null
|
||||||
|
@ -22,6 +23,7 @@ class InsertOrUpdateBolusTransaction(
|
||||||
timestamp = timestamp,
|
timestamp = timestamp,
|
||||||
amount = amount,
|
amount = amount,
|
||||||
type = type,
|
type = type,
|
||||||
|
notes = notes,
|
||||||
isBasalInsulin = isBasalInsulin,
|
isBasalInsulin = isBasalInsulin,
|
||||||
insulinConfiguration = insulinConfiguration,
|
insulinConfiguration = insulinConfiguration,
|
||||||
interfaceIDs_backing = interfaceIDs_backing
|
interfaceIDs_backing = interfaceIDs_backing
|
||||||
|
|
|
@ -14,11 +14,13 @@ class InsertOrUpdateCarbsTransaction(
|
||||||
timestamp: Long,
|
timestamp: Long,
|
||||||
amount: Double,
|
amount: Double,
|
||||||
duration: Long,
|
duration: Long,
|
||||||
|
notes: String,
|
||||||
interfaceIDs_backing: InterfaceIDs? = null
|
interfaceIDs_backing: InterfaceIDs? = null
|
||||||
) : this(Carbs(
|
) : this(Carbs(
|
||||||
timestamp = timestamp,
|
timestamp = timestamp,
|
||||||
amount = amount,
|
amount = amount,
|
||||||
duration = duration,
|
duration = duration,
|
||||||
|
notes = notes,
|
||||||
interfaceIDs_backing = interfaceIDs_backing
|
interfaceIDs_backing = interfaceIDs_backing
|
||||||
))
|
))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue