LoopKit / Loop

An automated insulin delivery app for iOS, built on LoopKit
https://loopdocs.org
Other
1.5k stars 1.29k forks source link

Glucose Range Picker causes crash using mmol/L and min or max values #1864

Closed SwiftlyNoah closed 1 month ago

SwiftlyNoah commented 1 year ago

Describe the bug When using mmol/L as glucoses units, all instances of GlucoseRangePicker (used to select normal correction range and premeal correction range) share a common bug: when setting the range to the lowest possible value to the lowest possible value OR the highest possible value to the highest possible value the app oftentimes crashes.

To Reproduce Steps to reproduce the behavior:

  1. Use mmol/L as glucose unit
  2. Adjust correction range to 4.4-4.4 or 10.0-10.0 in either onboarding or settings (likely chance of crash)
  3. Adjust premeal range to 4.4-4.4 or 10.0-10.0 in either onboarding or settings (likely chance of crash)

Expected behavior The app should accept these values

Phone

Loop Version

Why this happens From brief sleuthing, it appears to be due to a rounding error from mg/dL to mmol/L where the minValue is just higher than the maxValue of the range.

ps2 commented 1 year ago

Thanks. I know someone else had reported this error, too, on facebook.

marionbarker commented 1 year ago

Probably don't need this, but I did it so here's the report. Phone wiped clean of Loop app and Health data from Loop. Set health units to mmol/L. Build with LoopWorkspace (08-Dec-22)

I confirm the crash when trying to modify the glucose safety limit. The crash line is line 90 in SuspendThresholdEditor.swift

marionbarker commented 1 year ago

Coming in with a fresh build of Loop Master, prior settings were min and min/max for master

github-actions[bot] commented 1 year ago

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] commented 1 year ago

This issue was closed because it has been inactive for 14 days since being marked as stale.

mdavidsen commented 1 year ago

Bounced into this on a fresh dev-branch (3.3.0 (57)) just recently. Same issue as describe above where selecting the max value (10.0 mmol/L as both min and max values.

github-actions[bot] commented 7 months ago

This issue is stale because it has been open for 30 days with no activity.

marionbarker commented 7 months ago

Bump

github-actions[bot] commented 5 months ago

This issue is stale because it has been open for 30 days with no activity.

marionbarker commented 5 months ago

Bump. Fixed in dev.

marionbarker commented 2 months ago

This issue can be closed. It is now fixed in main.