fix TT units logging in automation

This commit is contained in:
Milos Kozak 2021-11-08 21:48:25 +01:00
parent c419c1f1e4
commit c684f12aa7

View file

@ -63,8 +63,8 @@ class ActionStartTempTarget(injector: HasAndroidInjector) : Action(injector) {
result.updated.forEach { aapsLogger.debug(LTag.DATABASE, "Updated temp target $it") } result.updated.forEach { aapsLogger.debug(LTag.DATABASE, "Updated temp target $it") }
uel.log(UserEntry.Action.TT, Sources.Automation, title, uel.log(UserEntry.Action.TT, Sources.Automation, title,
ValueWithUnit.TherapyEventTTReason(TemporaryTarget.Reason.AUTOMATION), ValueWithUnit.TherapyEventTTReason(TemporaryTarget.Reason.AUTOMATION),
ValueWithUnit.fromGlucoseUnit(tt().lowTarget, Constants.MGDL), ValueWithUnit.fromGlucoseUnit(tt().lowTarget, value.units.asText),
ValueWithUnit.fromGlucoseUnit(tt().highTarget, Constants.MGDL).takeIf { tt().lowTarget != tt().highTarget }, ValueWithUnit.fromGlucoseUnit(tt().highTarget, value.units.asText).takeIf { tt().lowTarget != tt().highTarget },
ValueWithUnit.Minute(TimeUnit.MILLISECONDS.toMinutes(tt().duration).toInt())) ValueWithUnit.Minute(TimeUnit.MILLISECONDS.toMinutes(tt().duration).toInt()))
callback.result(PumpEnactResult(injector).success(true).comment(R.string.ok))?.run() callback.result(PumpEnactResult(injector).success(true).comment(R.string.ok))?.run()
}, { }, {