Louai
JCHJava Community | Help. Code. Learn.
•Created by dghf on 3/19/2025 in #java-help
Issues with Contract Work Percentage Constraint in Employee Scheduling
it loop through Shift.class instead of Employee.class because we want to check actual assignments.
then it check if the shift has an assigned employee (shift.getEmployee() != null).
if it does then we go through the same logic
154 replies
JCHJava Community | Help. Code. Learn.
•Created by dghf on 3/19/2025 in #java-help
Issues with Contract Work Percentage Constraint in Employee Scheduling
i subtract the shiftminutes from the employeeworkminutes "workpercentage"
then im thinking about updating the working percentage each time a shift assign to the employee
154 replies
JCHJava Community | Help. Code. Learn.
•Created by dghf on 3/19/2025 in #java-help
Issues with Contract Work Percentage Constraint in Employee Scheduling
what do you think? is that better way?
154 replies
JCHJava Community | Help. Code. Learn.
•Created by dghf on 3/19/2025 in #java-help
Issues with Contract Work Percentage Constraint in Employee Scheduling
im rewriting the whole constriant hopes it becomes better
154 replies
JCHJava Community | Help. Code. Learn.
•Created by dghf on 3/19/2025 in #java-help
Issues with Contract Work Percentage Constraint in Employee Scheduling
its a thesis work so not really a big deal
154 replies
JCHJava Community | Help. Code. Learn.
•Created by dghf on 3/19/2025 in #java-help
Issues with Contract Work Percentage Constraint in Employee Scheduling
Correct, I didn't fully think about that 😅. Should we use 30-minute increments, or just round to the closest hour?
154 replies
JCHJava Community | Help. Code. Learn.
•Created by dghf on 3/19/2025 in #java-help
Issues with Contract Work Percentage Constraint in Employee Scheduling
maybe count the minutes then have a logic for the hours?
154 replies
JCHJava Community | Help. Code. Learn.
•Created by dghf on 3/19/2025 in #java-help
Issues with Contract Work Percentage Constraint in Employee Scheduling
the problem is i cant access the duration of single shift in filter
154 replies
JCHJava Community | Help. Code. Learn.
•Created by dghf on 3/19/2025 in #java-help
Issues with Contract Work Percentage Constraint in Employee Scheduling
but how
154 replies
JCHJava Community | Help. Code. Learn.
•Created by dghf on 3/19/2025 in #java-help
Issues with Contract Work Percentage Constraint in Employee Scheduling
ye that correct
154 replies
JCHJava Community | Help. Code. Learn.
•Created by dghf on 3/19/2025 in #java-help
Issues with Contract Work Percentage Constraint in Employee Scheduling
.toMinutes() and divide 60?
154 replies
JCHJava Community | Help. Code. Learn.
•Created by dghf on 3/19/2025 in #java-help
Issues with Contract Work Percentage Constraint in Employee Scheduling
this should be correct i think
154 replies
JCHJava Community | Help. Code. Learn.
•Created by dghf on 3/19/2025 in #java-help
Issues with Contract Work Percentage Constraint in Employee Scheduling
Duration.between(shift.getStart(), shift.getEnd()).toHours() represents the hours of a single shift
and totalWorkedHours should be the sum of all assigned shift hours for an employee.
then
154 replies
JCHJava Community | Help. Code. Learn.
•Created by dghf on 3/19/2025 in #java-help
Issues with Contract Work Percentage Constraint in Employee Scheduling
.groupBy(
(employee, shift) -> employee,
ConstraintCollectors.sum ((employee, shift) ->
(int) Duration.between(shift.getStart(), shift.getEnd()).toHours())
calculate the shift hours
154 replies
JCHJava Community | Help. Code. Learn.
•Created by dghf on 3/19/2025 in #java-help
Issues with Contract Work Percentage Constraint in Employee Scheduling
totalWorkedHours is the shift hours
154 replies
JCHJava Community | Help. Code. Learn.
•Created by dghf on 3/19/2025 in #java-help
Issues with Contract Work Percentage Constraint in Employee Scheduling
I think the logic is correct, but the current approach first calculates the shift's hours, then checks if the employee's work percentage allows them to take the shift. Instead, it should update the employee's remaining work percentage after assigning them a shift.
154 replies
JCHJava Community | Help. Code. Learn.
•Created by dghf on 3/19/2025 in #java-help
Issues with Contract Work Percentage Constraint in Employee Scheduling
154 replies
JCHJava Community | Help. Code. Learn.
•Created by dghf on 3/19/2025 in #java-help
Issues with Contract Work Percentage Constraint in Employee Scheduling
while its still solving
154 replies
JCHJava Community | Help. Code. Learn.
•Created by dghf on 3/19/2025 in #java-help
Issues with Contract Work Percentage Constraint in Employee Scheduling
"solverStatus": "SOLVING_ACTIVE"
154 replies
JCHJava Community | Help. Code. Learn.
•Created by dghf on 3/19/2025 in #java-help
Issues with Contract Work Percentage Constraint in Employee Scheduling
The solve status is a flag that indicates when the solving process is finishing. Since the Timefold solver performs solving while it's still in progress, the flag will show that it is still solving. Therefore, the status does not indicate anything about the shifts.
154 replies