Project::apply#
Writes edits into the accepted state of a Project and marks it unsolved. It doesn't schedule anything: follow it with solve(None) or level to get the new dates.
Signature#
Takes &mut self. Synchronous and CPU-only.
Parameters#
| Name | Type | Description |
|---|---|---|
changes |
&SchedulingChanges |
The edits to commit |
Behavior#
- Operations are ordered and partially accepted. A rejected operation goes into
ApplyReport::rejected, not into anErr. - Any rejection sets
needs_resync. After that,solve(None),applyandlevelfail until a fullsolve(Some(data)). - The state is unsolved afterwards, so
preview,load_profile,evaluate,suggest_assignmentsandrosterneed a solve first. - Tasks added or updated by successful operations are reported by the next acyclic
solve(None)orlevel.
Returns#
An ApplyReport with the applied and rejected operations and their side effects.
Errors#
| Error | When |
|---|---|
Error::Project(ProjectError::NeedsResync) |
An earlier apply was rejected and no solve(Some(data)) followed (checked first) |
Error::Project(ProjectError::StaleBaseline) |
changes.baseline_id doesn't name the current baseline |
Note
A start date that falls on non-working time is kept unsnapped when the task has no predecessor. The end is computed forward from it on the working calendar.
Example#
Commit an edit, resync with full data when part of it is rejected, and reschedule.
use ;
Related#
Project- the type and its other methodsSchedulingChanges- the change setApplyReport- the returned report- Data Updates - change sets, applying and rescheduling
- Recover from rejected changes - handling
needs_resync