JsonProject.solve#
Schedules a JsonProject and accepts the scheduled dates as its baseline. Pass project data to load a project, or null / undefined to reschedule after apply. preview, loadProfile, evaluate, slots and suggestAssignments need a solved project.
For a one-shot run without a handle, use schedule.
Signature#
data_json: string | null | undefined, options_json: string: string
Synchronous. Changes the project's state.
Request#
| Argument | Payload | Required | Description |
|---|---|---|---|
data_json |
ProjectData |
no | Replacement data. null or undefined schedules the current state |
options_json |
SolveOptions |
yes | Subtree, analytics and reporting switches. "{}" for defaults |
Behavior#
- With data: validates the replacement data, installs it, schedules it and accepts the result. The previous data is discarded. How the data is validated or repaired depends on the
validationoption the handle was created with. - Without data: schedules the current state when it has unsolved edits. When the project is already solved with equal options, it returns the cached result without scheduling again. The cache key is the whole options object.
Tasks touched by successful apply calls since the last solve appear in updates as direct updates, even when the planner leaves them where the edit put them. A cyclic project returns unchanged dates and keeps those tasks pending.
baselineId in the result names the accepted baseline. It changes only when the data or the dates change, so solving an unchanged state keeps it.
Response#
A success envelope with a ScheduleResult.
Errors#
kind |
code |
When |
|---|---|---|
parse |
null |
data_json or options_json isn't valid JSON, misses a required field, or has an unknown field where one is rejected (for example an unknown option) |
validation |
null |
The supplied data fails validation; path names the field when the engine found the problem |
project |
needs-resync |
No data after an apply rejected an operation, and no solve with data has followed |
After a parse or validation error the previous state and cached result are kept. Calling solve on a freed handle throws at host level; see Wire format.
Example#
Load a project, commit an edit and reschedule it, in Node:
const = ;
const = ;
const = new;
data_json for the first call:
Response of the first call (only the moved task is listed):
Response of the last call, after the edit to a:
Related#
ProjectData- the data to loadSolveOptions- subtree, analytics and reporting switchesScheduleResult- the result payloadJsonProject.apply- commit edits for the next solve to schedule- Scheduling a Project - loading and rescheduling a project