Skip to main content

Working Time Preference Constraint

Soft constraint

Deprecated constraint

The Working Time Preference Constraint is being deprecated in favour of the new EmployeeAvailabilityConstraint (non-strict variant). It is not suggested at this time to integrate with it, and instead to wait for the new constraint to be released.

Define intervals when employees prefer to work using particular weekdays, dates or day indices, and start and end time stamps.

See the payload example below to get started and check out the API reference for full configurability of the constraint.

Payload example

The following defines that all employees prefers to work between 08:00 and 16:00 during the weekdays. This constraint should also apply fairly to all employees, adjusted by their FTE working hours.

{
"workingTimePreferenceConstraints": [
{
"id": "wtpc-123",
"weight": 100,
"fairness": {
"fairnessWeight": 100,
"fteAdjustedFairness": true
},
"intervals": [
{
"scheduleDays": {
"weekDays": [1, 2, 3, 4, 5]
},
"startTime": "08:00",
"endTime": "16:00"
}
]
}
]
}
Working Time Preference Constraint in the request payload
id
required
string (constraintId)

Unique identifier for the constraint.

weight
integer (constraintWeightFullRange) [ -100 .. 100 ]
Deprecated

DEPRECATED - Use importance instead.

required
Array of objects (workingTimePreferenceInterval)
employeeIds
Array of strings (constraintEmployeeIds) unique

List of employee ids for which the constraint applies. The employee ids must be present in the employee section. If not specified, the constraint will be applied to all employees.

object (constraintFairness)
Deprecated

DEPRECATED - Use FairnessConstraints instead.

{
  • "example_1": {
    },
  • "summary": "This example defines a working time preference constraint which is applied to employees with ids 1, 2 and 3, and defines two intervals. Both intervals have work type id 0. The first interval is from Monday to Friday between 08:00 and 16:00, and the second interval is from Saturday to Sunday between 08:00 and 16:00. The first interval is weighted as 100 while the second interval is weighted as 50, which means that the preferences are considered less important during the weekend."
}