Fix uel after merge
This commit is contained in:
parent
22384ef2e8
commit
e829a6918c
7 changed files with 34 additions and 31 deletions
|
@ -281,13 +281,13 @@ class CarbsDialog : DialogFragmentWithDate() {
|
||||||
detailedBolusInfo.notes = notes
|
detailedBolusInfo.notes = notes
|
||||||
detailedBolusInfo.carbsDuration = T.mins(duration.toLong()).msecs()
|
detailedBolusInfo.carbsDuration = T.mins(duration.toLong()).msecs()
|
||||||
detailedBolusInfo.carbsTimestamp = time
|
detailedBolusInfo.carbsTimestamp = time
|
||||||
uel.log(if (detailedBolusInfo.carbsDuration == 0) Action.CARBS else Action.EXTENDED_CARBS,
|
uel.log(if (duration == 0) Action.CARBS else Action.EXTENDED_CARBS,
|
||||||
detailedBolusInfo.notes,
|
detailedBolusInfo.notes,
|
||||||
ValueWithUnit(Sources.CarbDialog),
|
ValueWithUnit(Sources.CarbDialog),
|
||||||
ValueWithUnit(detailedBolusInfo.timestamp, Units.Timestamp),
|
ValueWithUnit(detailedBolusInfo.timestamp, Units.Timestamp, eventTimeChanged),
|
||||||
ValueWithUnit(detailedBolusInfo.carbs, Units.G),
|
ValueWithUnit(carbsAfterConstraints, Units.G),
|
||||||
ValueWithUnit(detailedBolusInfo.carbTime, Units.M, detailedBolusInfo.carbTime != 0),
|
ValueWithUnit(timeOffset, Units.M, timeOffset != 0),
|
||||||
ValueWithUnit(detailedBolusInfo.carbsDuration, Units.H, detailedBolusInfo.carbsDuration != 0L)
|
ValueWithUnit(duration, Units.H, duration != 0)
|
||||||
)
|
)
|
||||||
//uel.log(Action.CARBS, notes, XXXValueWithUnit.Timestamp(eventTime).takeIf { eventTimeChanged }, XXXValueWithUnit.Gram(carbsAfterConstraints), XXXValueWithUnit.Minute(timeOffset).takeIf { timeOffset != 0 }, XXXValueWithUnit.Hour(duration).takeIf { duration != 0 })
|
//uel.log(Action.CARBS, notes, XXXValueWithUnit.Timestamp(eventTime).takeIf { eventTimeChanged }, XXXValueWithUnit.Gram(carbsAfterConstraints), XXXValueWithUnit.Minute(timeOffset).takeIf { timeOffset != 0 }, XXXValueWithUnit.Hour(duration).takeIf { duration != 0 })
|
||||||
commandQueue.bolus(detailedBolusInfo, object : Callback() {
|
commandQueue.bolus(detailedBolusInfo, object : Callback() {
|
||||||
|
@ -295,7 +295,7 @@ class CarbsDialog : DialogFragmentWithDate() {
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
ErrorHelperActivity.runAlarm(ctx, result.comment, resourceHelper.gs(R.string.treatmentdeliveryerror), R.raw.boluserror)
|
ErrorHelperActivity.runAlarm(ctx, result.comment, resourceHelper.gs(R.string.treatmentdeliveryerror), R.raw.boluserror)
|
||||||
} else
|
} else
|
||||||
uel.log(Action.BOLUS, notes, ValueWithUnit(carbsAfterConstraints, Units.G))
|
uel.log(Action.CARBS, notes, ValueWithUnit(carbsAfterConstraints, Units.G))
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -210,14 +210,14 @@ class InsulinDialog : DialogFragmentWithDate() {
|
||||||
detailedBolusInfo.context = context
|
detailedBolusInfo.context = context
|
||||||
detailedBolusInfo.notes = notes
|
detailedBolusInfo.notes = notes
|
||||||
detailedBolusInfo.timestamp = time
|
detailedBolusInfo.timestamp = time
|
||||||
|
if (recordOnlyChecked) {
|
||||||
//uel.log(Action.BOLUS_RECORD, notes, XXXValueWithUnit.Insulin(insulinAfterConstraints), XXXValueWithUnit.Minute(timeOffset).takeIf { timeOffset!= 0 })
|
//uel.log(Action.BOLUS_RECORD, notes, XXXValueWithUnit.Insulin(insulinAfterConstraints), XXXValueWithUnit.Minute(timeOffset).takeIf { timeOffset!= 0 })
|
||||||
uel.log(Action.BOLUS, notes,
|
uel.log(Action.BOLUS, notes,
|
||||||
ValueWithUnit(detailedBolusInfo.timestamp, Units.Timestamp),
|
ValueWithUnit(Sources.InsulinDialog),
|
||||||
, ValueWithUnit(R.string.record, Units.R_String, recordOnlyChecked),
|
ValueWithUnit(detailedBolusInfo.timestamp, Units.Timestamp, eventTimeChanged),
|
||||||
|
ValueWithUnit(R.string.record, Units.R_String),
|
||||||
ValueWithUnit(detailedBolusInfo.insulin, Units.U),
|
ValueWithUnit(detailedBolusInfo.insulin, Units.U),
|
||||||
ValueWithUnit(timeOffset, Units.M, timeOffset != 0)
|
ValueWithUnit(timeOffset, Units.M, timeOffset != 0))
|
||||||
)
|
|
||||||
if (recordOnlyChecked) {
|
|
||||||
disposable += repository.runTransactionForResult(detailedBolusInfo.insertBolusTransaction())
|
disposable += repository.runTransactionForResult(detailedBolusInfo.insertBolusTransaction())
|
||||||
.subscribe(
|
.subscribe(
|
||||||
{ result -> result.inserted.forEach { aapsLogger.debug(LTag.DATABASE, "Inserted bolus $it") } },
|
{ result -> result.inserted.forEach { aapsLogger.debug(LTag.DATABASE, "Inserted bolus $it") } },
|
||||||
|
@ -229,7 +229,9 @@ class InsulinDialog : DialogFragmentWithDate() {
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
ErrorHelperActivity.runAlarm(ctx, result.comment, resourceHelper.gs(R.string.treatmentdeliveryerror), info.nightscout.androidaps.dana.R.raw.boluserror)
|
ErrorHelperActivity.runAlarm(ctx, result.comment, resourceHelper.gs(R.string.treatmentdeliveryerror), info.nightscout.androidaps.dana.R.raw.boluserror)
|
||||||
} else
|
} else
|
||||||
uel.log(Action.BOLUS, notes, ValueWithUnit(insulinAfterConstraints, Units.U))
|
uel.log(Action.BOLUS, notes,
|
||||||
|
ValueWithUnit(Sources.InsulinDialog),
|
||||||
|
ValueWithUnit(insulinAfterConstraints, Units.U))
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -144,19 +144,19 @@ class TreatmentDialog : DialogFragmentWithDate() {
|
||||||
carbsAfterConstraints.equals(0) -> Action.BOLUS
|
carbsAfterConstraints.equals(0) -> Action.BOLUS
|
||||||
else -> Action.TREATMENT
|
else -> Action.TREATMENT
|
||||||
}
|
}
|
||||||
uel.log(action, ValueWithUnit(Sources.TreatmentDialog), ValueWithUnit(insulin, Units.U, insulin != 0.0), ValueWithUnit(carbs, Units.G, carbs != 0))
|
|
||||||
val detailedBolusInfo = DetailedBolusInfo()
|
val detailedBolusInfo = DetailedBolusInfo()
|
||||||
if (insulinAfterConstraints == 0.0) detailedBolusInfo.eventType = DetailedBolusInfo.EventType.CARBS_CORRECTION
|
if (insulinAfterConstraints == 0.0) detailedBolusInfo.eventType = DetailedBolusInfo.EventType.CARBS_CORRECTION
|
||||||
if (carbsAfterConstraints == 0) detailedBolusInfo.eventType = DetailedBolusInfo.EventType.CORRECTION_BOLUS
|
if (carbsAfterConstraints == 0) detailedBolusInfo.eventType = DetailedBolusInfo.EventType.CORRECTION_BOLUS
|
||||||
detailedBolusInfo.insulin = insulinAfterConstraints
|
detailedBolusInfo.insulin = insulinAfterConstraints
|
||||||
detailedBolusInfo.carbs = carbsAfterConstraints.toDouble()
|
detailedBolusInfo.carbs = carbsAfterConstraints.toDouble()
|
||||||
detailedBolusInfo.context = context
|
detailedBolusInfo.context = context
|
||||||
uel.log(Action.TREATMENT,
|
|
||||||
ValueWithUnit(detailedBolusInfo.timestamp, Units.Timestamp),
|
|
||||||
ValueWithUnit(insulin, Units.U, insulin != 0.0),
|
|
||||||
ValueWithUnit(carbs, Units.G, carbs != 0)
|
|
||||||
)
|
|
||||||
if (recordOnlyChecked) {
|
if (recordOnlyChecked) {
|
||||||
|
uel.log(action,
|
||||||
|
ValueWithUnit(Sources.TreatmentDialog),
|
||||||
|
ValueWithUnit(detailedBolusInfo.timestamp, Units.Timestamp, eventTimeChanged),
|
||||||
|
ValueWithUnit(R.string.record, Units.R_String),
|
||||||
|
ValueWithUnit(insulinAfterConstraints, Units.U, insulin != 0.0),
|
||||||
|
ValueWithUnit(carbsAfterConstraints, Units.G, carbs != 0))
|
||||||
disposable += repository.runTransactionForResult(detailedBolusInfo.insertBolusTransaction())
|
disposable += repository.runTransactionForResult(detailedBolusInfo.insertBolusTransaction())
|
||||||
.subscribe(
|
.subscribe(
|
||||||
{ result -> result.inserted.forEach { aapsLogger.debug(LTag.DATABASE, "Inserted bolus $it") } },
|
{ result -> result.inserted.forEach { aapsLogger.debug(LTag.DATABASE, "Inserted bolus $it") } },
|
||||||
|
@ -172,7 +172,12 @@ class TreatmentDialog : DialogFragmentWithDate() {
|
||||||
override fun run() {
|
override fun run() {
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
ErrorHelperActivity.runAlarm(ctx, result.comment, resourceHelper.gs(R.string.treatmentdeliveryerror), info.nightscout.androidaps.dana.R.raw.boluserror)
|
ErrorHelperActivity.runAlarm(ctx, result.comment, resourceHelper.gs(R.string.treatmentdeliveryerror), info.nightscout.androidaps.dana.R.raw.boluserror)
|
||||||
}
|
} else
|
||||||
|
uel.log(action,
|
||||||
|
ValueWithUnit(Sources.TreatmentDialog),
|
||||||
|
ValueWithUnit(insulin, Units.U, insulin != 0.0),
|
||||||
|
ValueWithUnit(carbs, Units.G, carbs != 0)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,9 +18,7 @@ import info.nightscout.androidaps.data.Profile
|
||||||
import info.nightscout.androidaps.database.AppRepository
|
import info.nightscout.androidaps.database.AppRepository
|
||||||
import info.nightscout.androidaps.database.entities.XXXValueWithUnit
|
import info.nightscout.androidaps.database.entities.XXXValueWithUnit
|
||||||
import info.nightscout.androidaps.database.entities.TemporaryTarget
|
import info.nightscout.androidaps.database.entities.TemporaryTarget
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
import info.nightscout.androidaps.database.entities.UserEntry.*
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry.Units
|
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry.ValueWithUnit
|
|
||||||
import info.nightscout.androidaps.database.transactions.CancelCurrentTemporaryTargetIfAnyTransaction
|
import info.nightscout.androidaps.database.transactions.CancelCurrentTemporaryTargetIfAnyTransaction
|
||||||
import info.nightscout.androidaps.database.transactions.InsertTemporaryTargetAndCancelCurrentTransaction
|
import info.nightscout.androidaps.database.transactions.InsertTemporaryTargetAndCancelCurrentTransaction
|
||||||
import info.nightscout.androidaps.events.EventPreferenceChange
|
import info.nightscout.androidaps.events.EventPreferenceChange
|
||||||
|
|
|
@ -15,9 +15,7 @@ import info.nightscout.androidaps.database.AppRepository
|
||||||
import info.nightscout.androidaps.database.ValueWrapper
|
import info.nightscout.androidaps.database.ValueWrapper
|
||||||
import info.nightscout.androidaps.database.entities.XXXValueWithUnit
|
import info.nightscout.androidaps.database.entities.XXXValueWithUnit
|
||||||
import info.nightscout.androidaps.database.entities.TemporaryTarget
|
import info.nightscout.androidaps.database.entities.TemporaryTarget
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
import info.nightscout.androidaps.database.entities.UserEntry.*
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry.Units
|
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry.ValueWithUnit
|
|
||||||
import info.nightscout.androidaps.database.interfaces.end
|
import info.nightscout.androidaps.database.interfaces.end
|
||||||
import info.nightscout.androidaps.database.transactions.InvalidateTemporaryTargetTransaction
|
import info.nightscout.androidaps.database.transactions.InvalidateTemporaryTargetTransaction
|
||||||
import info.nightscout.androidaps.databinding.TreatmentsTemptargetFragmentBinding
|
import info.nightscout.androidaps.databinding.TreatmentsTemptargetFragmentBinding
|
||||||
|
|
|
@ -348,7 +348,7 @@ class BolusWizard @Inject constructor(
|
||||||
bolusCalculatorResult = createBolusCalculatorResult()
|
bolusCalculatorResult = createBolusCalculatorResult()
|
||||||
notes = this@BolusWizard.notes
|
notes = this@BolusWizard.notes
|
||||||
//uel.log(Action.BOLUS_ADVISOR, notes, XXXValueWithUnit.TherapyEventType(eventType), XXXValueWithUnit.Insulin(insulinAfterConstraints))
|
//uel.log(Action.BOLUS_ADVISOR, notes, XXXValueWithUnit.TherapyEventType(eventType), XXXValueWithUnit.Insulin(insulinAfterConstraints))
|
||||||
uel.log(Action.BOLUS_ADVISOR, notes, ValueWithUnit(Sources.WizardDialog), ValueWithUnit(eventType.toDBbEventType(), Units.TherapyEvent), ValueWithUnit(insulinAfterConstraints, Units.U))
|
uel.log(Action.BOLUS_ADVISOR, notes, ValueWithUnit(Sources.WizardDialog), ValueWithUnit(eventType.toDBbEventType().text, Units.TherapyEvent), ValueWithUnit(insulinAfterConstraints, Units.U))
|
||||||
if (insulin > 0) {
|
if (insulin > 0) {
|
||||||
commandQueue.bolus(this, object : Callback() {
|
commandQueue.bolus(this, object : Callback() {
|
||||||
override fun run() {
|
override fun run() {
|
||||||
|
@ -420,8 +420,8 @@ class BolusWizard @Inject constructor(
|
||||||
}
|
}
|
||||||
uel.log(action, notes,
|
uel.log(action, notes,
|
||||||
ValueWithUnit(Sources.WizardDialog),
|
ValueWithUnit(Sources.WizardDialog),
|
||||||
ValueWithUnit(eventType.toDBbEventType(), Units.TherapyEvent),
|
ValueWithUnit(eventType.toDBbEventType().text, Units.TherapyEvent),
|
||||||
ValueWithUnit(insulinAfterConstraints, Units.U),
|
ValueWithUnit(insulinAfterConstraints, Units.U, insulinAfterConstraints != 0.0),
|
||||||
ValueWithUnit(this@BolusWizard.carbs, Units.G, this@BolusWizard.carbs != 0),
|
ValueWithUnit(this@BolusWizard.carbs, Units.G, this@BolusWizard.carbs != 0),
|
||||||
ValueWithUnit(carbTime, Units.M, carbTime != 0)
|
ValueWithUnit(carbTime, Units.M, carbTime != 0)
|
||||||
)
|
)
|
||||||
|
|
|
@ -14,7 +14,7 @@ class Translator @Inject internal constructor(
|
||||||
) {
|
) {
|
||||||
|
|
||||||
@Deprecated("use type instead of string")
|
@Deprecated("use type instead of string")
|
||||||
fun translate(text: String): String = ""
|
fun translate(text: String): String = text
|
||||||
|
|
||||||
fun translate(action: Action): String = when(action) {
|
fun translate(action: Action): String = when(action) {
|
||||||
Action.BOLUS -> resourceHelper.gs(R.string.uel_bolus)
|
Action.BOLUS -> resourceHelper.gs(R.string.uel_bolus)
|
||||||
|
|
Loading…
Reference in a new issue