Skip to content

Percent redistribution can produce negative or >100 values without guardrails #16

@edunzer

Description

@edunzer

If provided percentages are inconsistent (e.g., sum of valid categories > 100), diff becomes negative and addEach reduces each category. That can drive individual category percentages negative, producing negative hours-per-day.

How to fix: Add validation:

  • Ensure each input pct is between 0 and 100
  • Ensure the sum across provided categories is ~100 (or allow variance but clamp)
  • After redistribution, clamp at 0 and re-normalize (or throw error).

File: ScheduleHoursDistributor.cls (redistribution section in generateCategoryScheduleExceptions)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions