Fix uel after merge

This commit is contained in:
Philoul 2021-03-29 22:30:44 +02:00
parent 22384ef2e8
commit e829a6918c
7 changed files with 34 additions and 31 deletions

View file

@ -281,13 +281,13 @@ class CarbsDialog : DialogFragmentWithDate() {
detailedBolusInfo.notes = notes
detailedBolusInfo.carbsDuration = T.mins(duration.toLong()).msecs()
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,
ValueWithUnit(Sources.CarbDialog),
ValueWithUnit(detailedBolusInfo.timestamp, Units.Timestamp),
ValueWithUnit(detailedBolusInfo.carbs, Units.G),
ValueWithUnit(detailedBolusInfo.carbTime, Units.M, detailedBolusInfo.carbTime != 0),
ValueWithUnit(detailedBolusInfo.carbsDuration, Units.H, detailedBolusInfo.carbsDuration != 0L)
ValueWithUnit(detailedBolusInfo.timestamp, Units.Timestamp, eventTimeChanged),
ValueWithUnit(carbsAfterConstraints, Units.G),
ValueWithUnit(timeOffset, Units.M, timeOffset != 0),
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 })
commandQueue.bolus(detailedBolusInfo, object : Callback() {
@ -295,7 +295,7 @@ class CarbsDialog : DialogFragmentWithDate() {
if (!result.success) {
ErrorHelperActivity.runAlarm(ctx, result.comment, resourceHelper.gs(R.string.treatmentdeliveryerror), R.raw.boluserror)
} else
uel.log(Action.BOLUS, notes, ValueWithUnit(carbsAfterConstraints, Units.G))
uel.log(Action.CARBS, notes, ValueWithUnit(carbsAfterConstraints, Units.G))
}
})

View file

@ -210,14 +210,14 @@ class InsulinDialog : DialogFragmentWithDate() {
detailedBolusInfo.context = context
detailedBolusInfo.notes = notes
detailedBolusInfo.timestamp = time
if (recordOnlyChecked) {
//uel.log(Action.BOLUS_RECORD, notes, XXXValueWithUnit.Insulin(insulinAfterConstraints), XXXValueWithUnit.Minute(timeOffset).takeIf { timeOffset!= 0 })
uel.log(Action.BOLUS, notes,
ValueWithUnit(detailedBolusInfo.timestamp, Units.Timestamp),
, ValueWithUnit(R.string.record, Units.R_String, recordOnlyChecked),
ValueWithUnit(Sources.InsulinDialog),
ValueWithUnit(detailedBolusInfo.timestamp, Units.Timestamp, eventTimeChanged),
ValueWithUnit(R.string.record, Units.R_String),
ValueWithUnit(detailedBolusInfo.insulin, Units.U),
ValueWithUnit(timeOffset, Units.M, timeOffset != 0)
)
if (recordOnlyChecked) {
ValueWithUnit(timeOffset, Units.M, timeOffset != 0))
disposable += repository.runTransactionForResult(detailedBolusInfo.insertBolusTransaction())
.subscribe(
{ result -> result.inserted.forEach { aapsLogger.debug(LTag.DATABASE, "Inserted bolus $it") } },
@ -229,7 +229,9 @@ class InsulinDialog : DialogFragmentWithDate() {
if (!result.success) {
ErrorHelperActivity.runAlarm(ctx, result.comment, resourceHelper.gs(R.string.treatmentdeliveryerror), info.nightscout.androidaps.dana.R.raw.boluserror)
} else
uel.log(Action.BOLUS, notes, ValueWithUnit(insulinAfterConstraints, Units.U))
uel.log(Action.BOLUS, notes,
ValueWithUnit(Sources.InsulinDialog),
ValueWithUnit(insulinAfterConstraints, Units.U))
}
})

View file

@ -144,19 +144,19 @@ class TreatmentDialog : DialogFragmentWithDate() {
carbsAfterConstraints.equals(0) -> Action.BOLUS
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()
if (insulinAfterConstraints == 0.0) detailedBolusInfo.eventType = DetailedBolusInfo.EventType.CARBS_CORRECTION
if (carbsAfterConstraints == 0) detailedBolusInfo.eventType = DetailedBolusInfo.EventType.CORRECTION_BOLUS
detailedBolusInfo.insulin = insulinAfterConstraints
detailedBolusInfo.carbs = carbsAfterConstraints.toDouble()
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) {
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())
.subscribe(
{ result -> result.inserted.forEach { aapsLogger.debug(LTag.DATABASE, "Inserted bolus $it") } },
@ -172,7 +172,12 @@ class TreatmentDialog : DialogFragmentWithDate() {
override fun run() {
if (!result.success) {
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)
)
}
})
}

View file

@ -18,9 +18,7 @@ import info.nightscout.androidaps.data.Profile
import info.nightscout.androidaps.database.AppRepository
import info.nightscout.androidaps.database.entities.XXXValueWithUnit
import info.nightscout.androidaps.database.entities.TemporaryTarget
import info.nightscout.androidaps.database.entities.UserEntry.Action
import info.nightscout.androidaps.database.entities.UserEntry.Units
import info.nightscout.androidaps.database.entities.UserEntry.ValueWithUnit
import info.nightscout.androidaps.database.entities.UserEntry.*
import info.nightscout.androidaps.database.transactions.CancelCurrentTemporaryTargetIfAnyTransaction
import info.nightscout.androidaps.database.transactions.InsertTemporaryTargetAndCancelCurrentTransaction
import info.nightscout.androidaps.events.EventPreferenceChange

View file

@ -15,9 +15,7 @@ import info.nightscout.androidaps.database.AppRepository
import info.nightscout.androidaps.database.ValueWrapper
import info.nightscout.androidaps.database.entities.XXXValueWithUnit
import info.nightscout.androidaps.database.entities.TemporaryTarget
import info.nightscout.androidaps.database.entities.UserEntry.Action
import info.nightscout.androidaps.database.entities.UserEntry.Units
import info.nightscout.androidaps.database.entities.UserEntry.ValueWithUnit
import info.nightscout.androidaps.database.entities.UserEntry.*
import info.nightscout.androidaps.database.interfaces.end
import info.nightscout.androidaps.database.transactions.InvalidateTemporaryTargetTransaction
import info.nightscout.androidaps.databinding.TreatmentsTemptargetFragmentBinding

View file

@ -348,7 +348,7 @@ class BolusWizard @Inject constructor(
bolusCalculatorResult = createBolusCalculatorResult()
notes = this@BolusWizard.notes
//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) {
commandQueue.bolus(this, object : Callback() {
override fun run() {
@ -420,8 +420,8 @@ class BolusWizard @Inject constructor(
}
uel.log(action, notes,
ValueWithUnit(Sources.WizardDialog),
ValueWithUnit(eventType.toDBbEventType(), Units.TherapyEvent),
ValueWithUnit(insulinAfterConstraints, Units.U),
ValueWithUnit(eventType.toDBbEventType().text, Units.TherapyEvent),
ValueWithUnit(insulinAfterConstraints, Units.U, insulinAfterConstraints != 0.0),
ValueWithUnit(this@BolusWizard.carbs, Units.G, this@BolusWizard.carbs != 0),
ValueWithUnit(carbTime, Units.M, carbTime != 0)
)

View file

@ -14,7 +14,7 @@ class Translator @Inject internal constructor(
) {
@Deprecated("use type instead of string")
fun translate(text: String): String = ""
fun translate(text: String): String = text
fun translate(action: Action): String = when(action) {
Action.BOLUS -> resourceHelper.gs(R.string.uel_bolus)