Skip to content

Fix: allow labels after turning off Allow decimals - #174

Merged
mapgie merged 1 commit into
mainfrom
claude/labels-decimals-bug-o8k94g
Aug 22, 2026
Merged

Fix: allow labels after turning off Allow decimals#174
mapgie merged 1 commit into
mainfrom
claude/labels-decimals-bug-o8k94g

Conversation

@mapgie

@mapgie mapgie commented Aug 22, 2026

Copy link
Copy Markdown
Owner

Problem

On the category slider-scale screen, the Label values editor never appears when the scale was created with Allow decimals on, even after the user turns decimals back off.

The label editor is gated on canLabel:

val minInt = minText.toIntOrNull()
val maxInt = maxText.toIntOrNull()
val canLabel = !allowDecimals && minInt != null && maxInt != null && ...

When decimals are on, the Min/Max fields are formatted as "1.0" / "5.0". Toggling Allow decimals off only flips the allowDecimals flag; the text fields still hold "1.0" / "5.0", and "1.0".toIntOrNull() returns null. So minInt/maxInt stay null, canLabel stays false, and the label rows never render.

Fix

Reformat the Min/Max fields inside the switch's onCheckedChange: strip the trailing .0 when decimals are turned off (and re-add it when turned on), so integral values parse as whole numbers and the label editor re-enables. This also keeps the displayed values consistent with the new step mode.

Changes

  • ManageCategoryValuesScreen.kt: reformat Min/Max on the Allow decimals toggle.
  • Added changelog fragment (patch).
  • Added a LESSONS.md entry: a mode toggle must reformat the text fields whose parsing depends on that mode.

Testing

This environment has no Android toolchain, so verification is by inspection of the state flow. After turning decimals off, minText/maxText become "1"/"5", minInt/maxInt parse to 1/5, and canLabel becomes true.

🤖 Generated with Claude Code


Generated by Claude Code

Toggling Allow decimals only flipped the flag; the Min/Max fields kept
their decimal-formatted text ("1.0"/"5.0"), which toIntOrNull() cannot
parse. That left minInt/maxInt null and canLabel false, so the label
editor never re-enabled after decimals were switched off.

Reformat the Min/Max fields in the switch's onCheckedChange so whole
numbers are recognised (and the fields match the new step mode).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DzBrHAp8uQ2ddFFbQcGWtM
@mapgie
mapgie marked this pull request as ready for review August 22, 2026 17:35
@mapgie
mapgie merged commit d07d947 into main Aug 22, 2026
4 checks passed
@mapgie
mapgie deleted the claude/labels-decimals-bug-o8k94g branch August 22, 2026 17:35
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