AssignmentUpdate#
A partial edit of one existing assignment, matched by its id. Create one with AssignmentUpdate::new, set the fields to change, and pass it in SchedulingChanges::assignments .update to Project::apply.
Declaration#
Constructors#
AssignmentUpdate::new#
Creates an update for the assignment with this id. Every other field starts at Patch::Missing, so the update changes nothing until a field is set.
Parameters
| Name | Type | Description |
|---|---|---|
id |
impl Into<Id> |
Id of the assignment to edit. |
Returns an AssignmentUpdate with only id set.
Fields#
Every field except id is a Patch. Each field maps to the AssignmentData field of the same name, which describes how the value is read.
| Field | Type | Patch::Null |
|---|---|---|
id |
Id |
not a patch |
task |
Patch<Id> |
rejected (required field) |
resource |
Patch<Id> |
rejected (required field) |
value |
Patch<f64> |
rejected (required field) |
offset |
Patch<f64> |
clears it: the slice starts at the task start |
duration |
Patch<f64> |
clears it: the slice runs to the task end |
id#
pub id: Id
Id of the assignment to edit. It must match the id of an assignment already in the project. The id itself can't be changed.
task#
pub task:
Moves the assignment to another task. The new id must name a task in the project.
resource#
pub resource:
Hands the assignment to another resource. The new id must name a resource in the project.
value#
pub value:
New utilization rate. Must be finite and greater than 0.
offset#
pub offset:
New start of the slice, as worked time from the task start. Must be finite and >= 0. Patch::Null clears it, which is the same as 0.
duration#
pub duration:
New amount of worked time the slice books. Must be finite and greater than 0. Patch::Null clears it, so the slice runs to the task end.
Changes to offset and duration never move task dates. Changes to task and resource move dates only when a task ends up working on other calendars; see Resources and assignments.
Errors#
Project::apply lists a rejected update in ApplyReport::rejected at the path assignments.update[i]. An update is rejected when:
- no assignment has this
id task,resourceorvalueisPatch::Nulltaskorresourcenames an id that isn't in the projectvalue,offsetordurationis out of the range given for that field above- in
CalendarMode::Resource, the task's calendar and the resource's calendar share no weekly working time
Example#
Hand the second half of a 4-day task from anna to ben: anna keeps the first 2 days of work, and ben's assignment moves to start after them and run to the task end.
use ;
Related#
AssignmentData- the record an update editsPatch- the type of every editable fieldApplyReport- reports whether the update was applied- Split assignment work - uses
offsetanddurationupdates to hand work over - Data Updates - shows update records in a change set