Merge pull request #1301 from Philoul/Fix/WizardInfoMmol

Fix WizardInfoDialogMmol
This commit is contained in:
Milos Kozak 2022-02-11 09:50:17 +01:00 committed by GitHub
commit 738f30b1e6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 9 deletions

View file

@ -69,13 +69,15 @@ class WizardInfoDialog : DaggerDialogFragment() {
binding.close.setOnClickListener { dismiss() } binding.close.setOnClickListener { dismiss() }
val units = profileFunction.getUnits() val units = profileFunction.getUnits()
val bgString = Profile.toUnitsString(data.glucoseValue, data.glucoseValue * Constants.MGDL_TO_MMOLL, units) 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 // 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.bgInsulin.text = rh.gs(R.string.formatinsulinunits, data.glucoseInsulin)
binding.bgCheckbox.isChecked = data.wasGlucoseUsed binding.bgCheckbox.isChecked = data.wasGlucoseUsed
binding.ttCheckbox.isChecked = data.wasTempTargetUsed binding.ttCheckbox.isChecked = data.wasTempTargetUsed
// Trend // Trend
binding.bgTrend.text = DecimalFormatter.to1Decimal(data.glucoseTrend) binding.bgTrend.text = trend
binding.bgTrendInsulin.text = rh.gs(R.string.formatinsulinunits, data.trendInsulin) binding.bgTrendInsulin.text = rh.gs(R.string.formatinsulinunits, data.trendInsulin)
binding.bgTrendCheckbox.isChecked = data.wasTrendUsed binding.bgTrendCheckbox.isChecked = data.wasTrendUsed
// COB // COB

View file

@ -261,22 +261,23 @@ class BolusWizard @Inject constructor(
return this return this
} }
private fun createBolusCalculatorResult(): BolusCalculatorResult = private fun createBolusCalculatorResult(): BolusCalculatorResult {
BolusCalculatorResult( val unit = profileFunction.getUnits()
return BolusCalculatorResult(
timestamp = dateUtil.now(), timestamp = dateUtil.now(),
targetBGLow = targetBGLow, targetBGLow = Profile.toMgdl(targetBGLow, unit),
targetBGHigh = targetBGHigh, targetBGHigh = Profile.toMgdl(targetBGHigh, unit),
isf = sens, isf = Profile.toMgdl(sens, unit),
ic = ic, ic = ic,
bolusIOB = insulinFromBolusIOB, bolusIOB = insulinFromBolusIOB,
wasBolusIOBUsed = includeBolusIOB, wasBolusIOBUsed = includeBolusIOB,
basalIOB = insulinFromBasalIOB, basalIOB = insulinFromBasalIOB,
wasBasalIOBUsed = includeBasalIOB, wasBasalIOBUsed = includeBasalIOB,
glucoseValue = bg, glucoseValue = Profile.toMgdl(bg, unit),
wasGlucoseUsed = useBg && bg > 0, wasGlucoseUsed = useBg && bg > 0,
glucoseDifference = bgDiff, glucoseDifference = bgDiff,
glucoseInsulin = insulinFromBG, glucoseInsulin = insulinFromBG,
glucoseTrend = trend, glucoseTrend = Profile.fromMgdlToUnits(trend, unit),
wasTrendUsed = useTrend, wasTrendUsed = useTrend,
trendInsulin = insulinFromTrend, trendInsulin = insulinFromTrend,
cob = cob, cob = cob,
@ -294,6 +295,7 @@ class BolusWizard @Inject constructor(
profileName = profileName, profileName = profileName,
note = notes note = notes
) )
}
private fun confirmMessageAfterConstraints(advisor: Boolean): Spanned { private fun confirmMessageAfterConstraints(advisor: Boolean): Spanned {