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() }
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

View file

@ -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 {