From c684f12aa7a42decaa260231b33e5b9e6dc95c3e Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Mon, 8 Nov 2021 21:48:25 +0100 Subject: [PATCH] fix TT units logging in automation --- .../general/automation/actions/ActionStartTempTarget.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionStartTempTarget.kt b/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionStartTempTarget.kt index 48a0a85ba8..61a9d25952 100644 --- a/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionStartTempTarget.kt +++ b/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionStartTempTarget.kt @@ -63,8 +63,8 @@ class ActionStartTempTarget(injector: HasAndroidInjector) : Action(injector) { result.updated.forEach { aapsLogger.debug(LTag.DATABASE, "Updated temp target $it") } uel.log(UserEntry.Action.TT, Sources.Automation, title, ValueWithUnit.TherapyEventTTReason(TemporaryTarget.Reason.AUTOMATION), - ValueWithUnit.fromGlucoseUnit(tt().lowTarget, Constants.MGDL), - ValueWithUnit.fromGlucoseUnit(tt().highTarget, Constants.MGDL).takeIf { tt().lowTarget != tt().highTarget }, + ValueWithUnit.fromGlucoseUnit(tt().lowTarget, value.units.asText), + ValueWithUnit.fromGlucoseUnit(tt().highTarget, value.units.asText).takeIf { tt().lowTarget != tt().highTarget }, ValueWithUnit.Minute(TimeUnit.MILLISECONDS.toMinutes(tt().duration).toInt())) callback.result(PumpEnactResult(injector).success(true).comment(R.string.ok))?.run() }, {