Skip to content

Fill levels for numeric attributes - #17

Merged
acesonic7 merged 1 commit into
mainfrom
feat/fill-levels
Oct 7, 2026
Merged

acesonic7 merged 1 commit into
mainfrom
feat/fill-levels

Conversation

@acesonic7

Copy link
Copy Markdown
Owner

Summary

Numeric attributes get a Fill levels… button next to "Add level". It opens a panel that generates the level set:

  • Methods:

    • range + step (10 → 60 every 10);
    • range + count (5 levels from 15 to 75);
    • around a reference (30 ± 20% × 2 → 18, 24, 30, 36, 42);
    • geometric (5, 10, 20, 40).
  • Rounding by unit (lib/levelFill.ts):

    Attribute Steps offered Default
    minutes 1, 5, 10, 15 min 5 min
    hours 0.25, 0.5, 1 h 0.5 h
    money (currency format or units such as EUR, €, $, £) 0.01, 0.10, 0.50, 1.00 0.50
    pivot multipliers ×0.01, ×0.05, ×0.1 ×0.05
    other 0.1, 1, 5, 10 1
  • Apply to: the shared levels, or one alternative's own levels. The latter creates or replaces its per-alternative set.

  • Replace or add: "Replace" swaps in the new set. "Add to existing" merges the values into the current set. Levels whose value stays keep their id, display label and image.

  • Preview: the same number line as the levels editor, plus the values in mono.

  • Explanations, without blocking:

    • levels merged by rounding;
    • negative values (allowed for delta pivots);
    • non-positive multipliers;
    • more than 5 levels;
    • why geometric spacing helps;
    • a tip to use a multiplier pivot for respondent-specific references.
  • Invalid inputs show a reason instead of a preview (zero step, more than 12 levels, ratio of 1).

  • The panel starts from the attribute's current levels. Escape or Cancel closes it and returns focus to the button.

Test plan

  • npm test (1034 passed, 13 new in levelFill.test.ts), tsc --noEmit
  • Browser:
    • Travel time 15–75 × 5 → 15/30/45/60/75 min, with the original three level ids kept.
    • Cost as a multiplier pivot → ×0.6–×1.4 with ×0.05 rounding.
    • Cost in EUR → rounding options 0.01/0.10/0.50/1.00 EUR, defaulting to 0.50, and the merge warning when rounding collapses levels.
    • Escape closes the panel.
  • CI

🤖 Generated with Claude Code

Generates a level set from a range and step, a range and count, steps around
a reference, or a geometric series, rounded to units that suit the attribute
(minutes, hours, money in 0.01/0.10/0.50/1, pivot multipliers). It can replace
or add to the shared levels or one alternative's own levels, keeps existing
levels whose value stays, and explains merged, negative or too many levels.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
utilitylab Ready Ready Preview Oct 7, 2026 1:56pm UTC

@acesonic7
acesonic7 merged commit e2a8b2e into main Oct 7, 2026
3 checks passed
@acesonic7
acesonic7 deleted the feat/fill-levels branch October 7, 2026 14:13

This branch was successfully deployed

1 active deployment
Preview — 95164f5d Deployed Oct 7, 2026 by vercel[bot]
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.

1 participant