Loop icon indicating copy to clipboard operation
Loop copied to clipboard

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

Open SwiftlyNoah opened this issue 3 years ago • 10 comments

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

  • Simulator, iOS 16.1

Loop Version

  • Current dev workspace (9fd16c2) with the newest LoopKit/LoopKit submodule (7134679)

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.

SwiftlyNoah avatar Dec 08 '22 02:12 SwiftlyNoah

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

ps2 avatar Dec 08 '22 04:12 ps2

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)

  • 7d1989c Correction range crash fix, loop-not-looping message fix, improve OTP validation and logging
  • onboard selecting min allowed Glucose safety and min and max allowed for Correction and Premeal.

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

marionbarker avatar Dec 08 '22 14:12 marionbarker

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

  • I selected Glucose Safety limit of 3.8 mmol/L instead of 3.7.
    • When I go to edit after onboarding is finished, the 3.7 shows on the picker but I cannot save it.
  • I accepted the offered 4.8 to 10.0 for Correction Range
    • At edit, change to 4.9 to 9.9
    • Edit again, 4.8 to 10.0 can be selected and saved.
  • Premeal gave me no issues - lower limit is 3.8 as expected

marionbarker avatar Dec 08 '22 15:12 marionbarker

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

github-actions[bot] avatar Jul 19 '23 03:07 github-actions[bot]

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

github-actions[bot] avatar Aug 03 '23 02:08 github-actions[bot]

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.

mdavidsen avatar Sep 11 '23 19:09 mdavidsen

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

github-actions[bot] avatar Mar 21 '24 02:03 github-actions[bot]

Bump

marionbarker avatar Mar 21 '24 02:03 marionbarker

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

github-actions[bot] avatar Apr 21 '24 02:04 github-actions[bot]

Bump. Fixed in dev.

marionbarker avatar Apr 21 '24 04:04 marionbarker

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

marionbarker avatar Aug 16 '24 22:08 marionbarker