AssignmentData#

A plain object that books one resource on one task at a given rate. Pass these records in ProjectData.assignments to load a plan, or in the assignments.add bucket of a SchedulingChanges to add bookings later. An assignment changes resource load. Its offset and duration never move task dates.

Fields#

Field Type Default Description
id Id | null generated Unique among assignments. Without an id, the assignment gets a generated one; apply lists it in effects.generatedAssignments. Updates and removals address the assignment by this id.
task Id required The task being booked. Must name a task of the plan. task_id is accepted as an alias; task wins when both are present.
resource Id required The booked resource. Must name a resource of the plan. resource_id is accepted as an alias; resource wins when both are present.
value number required Booking rate in resource capacity units: 1 = 100 %. Must be finite and greater than 0.
offset number | null 0 Where the booked slice starts: worked time from the task start, in the task's duration_unit. Must be finite and at least 0. null reads as the default.
duration number | null to the task end Length of the booked slice: worked time, in the task's duration_unit. Must be finite and greater than 0. null reads as the default.

Worked time for offset and duration is counted on the assignment's working calendar and skips non-working time and pauses, so the slice moves with the task's work. The slice is clipped to the task's work when load is booked, not when the record is read: an offset at or past the task's duration books nothing, and a slice follows a task that later gets shorter. Several assignments of one resource on one task each book their own slice, and overlapping slices add up.

An assignment on an unscheduled task stays in the project and books nothing until the task is scheduled again; the result reports it as a dropped-assignment note.

Invalid values (an unknown task or resource, a duplicate id, a bad value, offset or duration) throw an InputError with a path such as assignments[0].value when the plan is loaded, and come back as a rejected operation from apply. With validation: "repair" on the Project, an invalid offset or duration is cleared and a duplicate id replaces the earlier record, each reported as a repaired note. Unknown fields are ignored.

Used by#

Example#

const assignments = [
  // Ann works full time on task 1.
  { id: "a1", task: 1, resource: "ann", value: 1 },
  // Bob works half time on task 1 for 2 working days, starting after its first
  // working day (task duration_unit: "day").
  { id: "a2", task: 1, resource: "bob", value: 0.5, offset: 1, duration: 2 },
];