It's better to make convertion in generateTempTarget for uel.log

Sorry

This reverts commit 9db58726
This commit is contained in:
Philoul 2021-10-18 21:07:06 +02:00
parent 9db587269a
commit f10080686b

View file

@ -507,11 +507,6 @@ class ActionStringHandler @Inject constructor(
val duration = SafeParse.stringToInt(act[2])
var low = SafeParse.stringToDouble(act[3])
var high = SafeParse.stringToDouble(act[4])
val isMGDL = java.lang.Boolean.parseBoolean(act[1])
if (!isMGDL) {
low *= Constants.MMOLL_TO_MGDL
high *= Constants.MMOLL_TO_MGDL
}
generateTempTarget(duration, low, high)
} else if ("wizard2" == act[0]) {
if (lastBolusWizard != null) { //use last calculation as confirmed string matches
@ -576,8 +571,8 @@ class ActionStringHandler @Inject constructor(
timestamp = System.currentTimeMillis(),
duration = TimeUnit.MINUTES.toMillis(duration.toLong()),
reason = TemporaryTarget.Reason.WEAR,
lowTarget = low,
highTarget = high
lowTarget = Profile.toMgdl(low, profileFunction.getUnits()),
highTarget = Profile.toMgdl(high, profileFunction.getUnits())
)).subscribe({ result ->
result.inserted.forEach { aapsLogger.debug(LTag.DATABASE, "Inserted temp target $it") }
result.updated.forEach { aapsLogger.debug(LTag.DATABASE, "Updated temp target $it") }