Skip to content

Inconsistent definition of “work days” vs. weekday-only counting #13

@edunzer

Description

@edunzer

countUsableWorkdays only counts Mon–Fri via isWeekday, but createScheduleException applies hours across up to 7 days based on input.numberOfWorkDays. If numberOfWorkDays includes weekends (6 or 7), your hours-per-day calculation is based on weekday-only counts, but exceptions may allocate hours to weekends too → misallocation.

How to fix: Align day counting with numberOfWorkDays:

  • If workDays <= 5, count only Mon–Fri.
  • If workDays == 6, count Mon–Sat.
  • If workDays == 7, count all days.
    You can implement an isWorkingDay(Date d, Integer workDays) helper and use it both for counting and splitting.

File: ScheduleHoursDistributor.cls (countUsableWorkdays, isWeekday, createScheduleException)

Metadata

Metadata

Assignees

No one assigned

    Labels

    issueNeeds to be fixed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions