From f6ecf8a5dff60cf1f6cca365c92b754e687d9289 Mon Sep 17 00:00:00 2001 From: Philoul Date: Mon, 29 Nov 2021 22:14:03 +0100 Subject: [PATCH] Fix Units mmol in Automation (internal unit in AAPS is mgdl) --- .../general/automation/actions/ActionCarePortalEvent.kt | 2 +- .../general/automation/actions/ActionStartTempTarget.kt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionCarePortalEvent.kt b/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionCarePortalEvent.kt index 5e3f3669eb..7a1b698e47 100644 --- a/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionCarePortalEvent.kt +++ b/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionCarePortalEvent.kt @@ -71,7 +71,7 @@ class ActionCarePortalEvent(injector: HasAndroidInjector) : Action(injector) { if (glucoseStatus != null) { therapyEvent.glucose = glucoseStatus.glucose therapyEvent.glucoseType = TherapyEvent.MeterType.SENSOR - valuesWithUnit.add(ValueWithUnit.fromGlucoseUnit(glucoseStatus.glucose, profileFunction.getUnits().asText)) + valuesWithUnit.add(ValueWithUnit.Mgdl(glucoseStatus.glucose)) valuesWithUnit.add(ValueWithUnit.TherapyEventMeterType(TherapyEvent.MeterType.SENSOR)) } } else { 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 61a9d25952..62d620b3ae 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, value.units.asText), - ValueWithUnit.fromGlucoseUnit(tt().highTarget, value.units.asText).takeIf { tt().lowTarget != tt().highTarget }, + ValueWithUnit.Mgdl(tt().lowTarget), + ValueWithUnit.Mgdl(tt().highTarget).takeIf { tt().lowTarget != tt().highTarget }, ValueWithUnit.Minute(TimeUnit.MILLISECONDS.toMinutes(tt().duration).toInt())) callback.result(PumpEnactResult(injector).success(true).comment(R.string.ok))?.run() }, {