Skip to content

Fix advancement percentage slider to skip invalid range below champions minimum#2103

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/clarify-advancement-percentage
Draft

Fix advancement percentage slider to skip invalid range below champions minimum#2103
Copilot wants to merge 3 commits intomainfrom
copilot/clarify-advancement-percentage

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 22, 2026

Description

Champions award winners always advance, so the slider previously allowed setting percentages that would advance fewer teams than champions awards — an invalid state. The slider now jumps directly from 0 (disabled) to the minimum percentage that covers all champions awards, then slides freely above that.

Changes

apps/admin/.../event-settings-section.tsx

  • Fetch awards for all divisions in parallel to count champions per division
  • Compute minAdvancementPercent: for each division, the smallest integer p where Math.round(teamCount × p / 100) ≥ championsCount, taking the max across divisions
    • Formula: Math.ceil((100 × champCount − 50) / teamCount) (derived from Math.round(x) ≥ c ⟺ x ≥ c − 0.5)
  • Slider onChange snaps values in (0, minPercent) based on drag direction: dragging up → minPercent, dragging down → 0
  • Adds a tick mark at minAdvancementPercent (deduplicated against existing 25/50/75/100 marks)
if (minAdvancementPercent !== null && v > 0 && v < minAdvancementPercent) {
  setAdvancementPercent(v < advancementPercent ? 0 : minAdvancementPercent);
}

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Screenshots

UI change: slider now has a visible mark at the minimum valid non-zero percentage and skips over the invalid range.

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • My changes generate no new warnings

@github-project-automation github-project-automation Bot moved this to Backlog in LEMS Apr 22, 2026
Copilot AI linked an issue Apr 22, 2026 that may be closed by this pull request
Copilot AI and others added 2 commits April 22, 2026 14:18
…rage

- Fetch awards per division to count champions awards
- Calculate minimum advancement percentage where all champions are covered
- Slider snaps over the invalid range (1..minPercent-1): dragging up jumps
  to minPercent, dragging down jumps to 0
- Add a mark on the slider at the minimum percentage

Agent-Logs-Url: https://github.com/FIRSTIsrael/lems/sessions/648015d3-06be-4d5f-90f9-8639b4122137

Co-authored-by: johnmeshulam <55348702+johnmeshulam@users.noreply.github.com>
…ifact

Agent-Logs-Url: https://github.com/FIRSTIsrael/lems/sessions/648015d3-06be-4d5f-90f9-8639b4122137

Co-authored-by: johnmeshulam <55348702+johnmeshulam@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix advancement percentage for champions awards Fix advancement percentage slider to skip invalid range below champions minimum Apr 22, 2026
Copilot AI requested a review from johnmeshulam April 22, 2026 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

Clarify advancement percentage

2 participants