Skip to content

Conversation

@olorinmaia
Copy link
Contributor

Inspired from: #4462

We often look at calculations on Wear to see current IOB to make sure when adding the calculated bolus from Bolus Wizard that the new IOB doesn't exceed a certain amount.

I've made this improvement to the Wizard Result in Wear. It will only show if IOB is used in the calculations.

Some screenshots.

IOB "positive"
Current IOB: 0,58
Calculated Bolus: 0,44
New IOB after Bolus: 0,98

Current IOB Result with new IOB
image image

IOB "negative"
Current IOB: -0,13
Calculated Bolus: 0,90
New IOB after Bolus: 0,77

Current IOB Result with new IOB
image image

When IOB is not used in calculations:
image

@sonarqubecloud
Copy link

// New IOB = Total Insulin - Current IOB (because IOB is subtracted in wizard)
// Only calculate if IOB was actually used (totalIob is not NaN means it was included)
val newIob = if (!totalIob.isNaN()) {
totalInsulin - totalIob

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tiny suggestion-- to an outsider like me, this looks weird. This is addition because totalIob is negative, correct? Maybe comments could be more specific?

Suggested change
totalInsulin - totalIob
totalInsulin - totalIob // totalIob is negative so this is addition

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants