日本語
@eightkk/vue-weave / core / comparePlans
Function: comparePlans()
comparePlans(
current,candidate):PlanComparison
Defined in: src/core/planComparison.ts:473
Compare a candidate plan with the current plan. Tasks, dependencies, calendars, resources and assignments are matched by ID (assignments by task and resource). The result has two separate parts: input, the differences of the inputs, and result, the differences of the calculated schedules (dates, critical flags, final completion, violations and cumulative overload per resource). A task whose own input or assignments differ is edited; a task whose input is unchanged but whose result differs is listed in consequenceTaskIds. A plan that cannot be scheduled (cycle or infeasible, a deadline failure included) is reported in result.state and the input differences are still returned. Missing results are calculated with scheduleTasks(input, { explain: true }). Each side is validated by the scheduler's own rules (also when its result is given) and the shared resource and assignment checks; every error of a side ends with (current plan) or (candidate plan) and keeps the class of its check. Throws Error for duplicate or invalid IDs, other invalid scheduling input, unknown assignment references and results that do not match their input, and RangeError for invalid numbers, deadlines or load segments. The arguments are not modified.
A given successful result must match the task set of its input: each active task (not inactive and not under an inactive summary) appears exactly once in result.tasks, no other task appears, and inactiveTaskIds lists exactly the inactive tasks. Otherwise an Error is thrown, so a result calculated before a task was added, removed or (de)activated is rejected instead of being compared as a complete plan. The check compares task sets only: a result calculated for an earlier version of the same tasks (a changed duration, dependency or calendar) cannot be detected and is compared as given; keep a revision shared by the input and its result, or omit result, when that matters. A failed result (cycle or infeasible) lists no tasks and is checked only for its shape. A partial plan is checked the same way: its result must have been calculated from the loaded input it is passed with.