From c5d13147f3c8aa91b8d3964878b2cf1b7f21af4d Mon Sep 17 00:00:00 2001 From: Philoul Date: Fri, 11 Feb 2022 00:37:41 +0100 Subject: [PATCH] Fix WizardInfoDialogMmol --- .../androidaps/dialogs/WizardInfoDialog.kt | 6 ++++-- .../androidaps/utils/wizard/BolusWizard.kt | 16 +++++++++------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/WizardInfoDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/WizardInfoDialog.kt index 6a6aaf32fa..da6094487e 100644 --- a/app/src/main/java/info/nightscout/androidaps/dialogs/WizardInfoDialog.kt +++ b/app/src/main/java/info/nightscout/androidaps/dialogs/WizardInfoDialog.kt @@ -69,13 +69,15 @@ class WizardInfoDialog : DaggerDialogFragment() { binding.close.setOnClickListener { dismiss() } val units = profileFunction.getUnits() val bgString = Profile.toUnitsString(data.glucoseValue, data.glucoseValue * Constants.MGDL_TO_MMOLL, units) + val isf = Profile.toUnits(data.isf, data.isf * Constants.MGDL_TO_MMOLL, units) + val trend = Profile.toUnitsString(data.glucoseTrend * 3, data.glucoseTrend * 3 * Constants.MGDL_TO_MMOLL, profileFunction.getUnits()) // BG - binding.bg.text = rh.gs(R.string.format_bg_isf, bgString, data.isf) + binding.bg.text = rh.gs(R.string.format_bg_isf, bgString, isf) binding.bgInsulin.text = rh.gs(R.string.formatinsulinunits, data.glucoseInsulin) binding.bgCheckbox.isChecked = data.wasGlucoseUsed binding.ttCheckbox.isChecked = data.wasTempTargetUsed // Trend - binding.bgTrend.text = DecimalFormatter.to1Decimal(data.glucoseTrend) + binding.bgTrend.text = trend binding.bgTrendInsulin.text = rh.gs(R.string.formatinsulinunits, data.trendInsulin) binding.bgTrendCheckbox.isChecked = data.wasTrendUsed // COB diff --git a/app/src/main/java/info/nightscout/androidaps/utils/wizard/BolusWizard.kt b/app/src/main/java/info/nightscout/androidaps/utils/wizard/BolusWizard.kt index d1f9321746..a9692e9ec6 100644 --- a/app/src/main/java/info/nightscout/androidaps/utils/wizard/BolusWizard.kt +++ b/app/src/main/java/info/nightscout/androidaps/utils/wizard/BolusWizard.kt @@ -261,22 +261,23 @@ class BolusWizard @Inject constructor( return this } - private fun createBolusCalculatorResult(): BolusCalculatorResult = - BolusCalculatorResult( + private fun createBolusCalculatorResult(): BolusCalculatorResult { + val unit = profileFunction.getUnits() + return BolusCalculatorResult( timestamp = dateUtil.now(), - targetBGLow = targetBGLow, - targetBGHigh = targetBGHigh, - isf = sens, + targetBGLow = Profile.toMgdl(targetBGLow, unit), + targetBGHigh = Profile.toMgdl(targetBGHigh, unit), + isf = Profile.toMgdl(sens, unit), ic = ic, bolusIOB = insulinFromBolusIOB, wasBolusIOBUsed = includeBolusIOB, basalIOB = insulinFromBasalIOB, wasBasalIOBUsed = includeBasalIOB, - glucoseValue = bg, + glucoseValue = Profile.toMgdl(bg, unit), wasGlucoseUsed = useBg && bg > 0, glucoseDifference = bgDiff, glucoseInsulin = insulinFromBG, - glucoseTrend = trend, + glucoseTrend = Profile.fromMgdlToUnits(trend, unit), wasTrendUsed = useTrend, trendInsulin = insulinFromTrend, cob = cob, @@ -294,6 +295,7 @@ class BolusWizard @Inject constructor( profileName = profileName, note = notes ) + } private fun confirmMessageAfterConstraints(advisor: Boolean): Spanned {