Skip to content

Commit a67bc7d

Browse files
authored
Adjust target working time calculation (#248)
Adjust target working time calculation to account for available working days
1 parent 5524f39 commit a67bc7d

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/cp/constraints/target_working_time.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,16 @@ def create(
5454
if employee.hidden:
5555
target_working_time = round(40 * 60 * 4.35)
5656
else:
57+
available_days = set(range(1, len(self._days) + 1)) - (
58+
set(employee.vacation_days) | set(employee._forbidden_days) # pyright: ignore[reportPrivateUsage]
59+
)
60+
5761
# maybe it effects the tool that working_time_domain is probably MUCH larger than
5862
# target_working_time - TOLERANCE_LESS <= working_time_variable <= target_working_time + TOLERANCE_MORE
5963
target_working_time = round(
6064
max(
61-
employee.target_working_time * (1 - len(employee.vacation_days) / len(self._days))
62-
- employee.actual_working_time,
65+
employee.target_working_time * len(available_days) / len(self._days),
66+
-employee.actual_working_time,
6367
0,
6468
)
6569
)

0 commit comments

Comments
 (0)