Fix Units mmol in Automation (internal unit in AAPS is mgdl)

This commit is contained in:
Philoul 2021-11-29 22:14:03 +01:00
parent 90e2c8f65f
commit f6ecf8a5df
2 changed files with 3 additions and 3 deletions

View file

@ -71,7 +71,7 @@ class ActionCarePortalEvent(injector: HasAndroidInjector) : Action(injector) {
if (glucoseStatus != null) { if (glucoseStatus != null) {
therapyEvent.glucose = glucoseStatus.glucose therapyEvent.glucose = glucoseStatus.glucose
therapyEvent.glucoseType = TherapyEvent.MeterType.SENSOR 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)) valuesWithUnit.add(ValueWithUnit.TherapyEventMeterType(TherapyEvent.MeterType.SENSOR))
} }
} else { } else {

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, value.units.asText), ValueWithUnit.Mgdl(tt().lowTarget),
ValueWithUnit.fromGlucoseUnit(tt().highTarget, value.units.asText).takeIf { tt().lowTarget != tt().highTarget }, ValueWithUnit.Mgdl(tt().highTarget).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()
}, { }, {