Open colinmacgiolla opened 2 years ago
yes, unfortunately this is a big caveat with the Task API, which is one other reason why it is going away in the near future. There's no easy way to get the assignable tasks, without a lot of work, basically you'd have to get all the CCs and go through each stage and check if any stage has any taskIDs that match your pending Task list, but not sure if that's worth the effort; the UI unfortunately is reading this directly from the db, but does a similar yet less expensive operation to figure this out
I think a better solution would be to create/execute/schedule change controls from the tasks you generate with your scripts, as you will always get the taskIds for each of your actions like adding configlets, moving devices, etc.
The UI performs the following check:
if (status === TASK_STATUS.PENDING) {
if (_.isEmpty(cc)) {
return true;
}
return (
cc.status === CHANGE_CONTROL_STATUS.COMPLETED || cc.status === CHANGE_CONTROL_STATUS.FAILED
);
}
if (status === TASK_STATUS.FAILED) {
if (!_.isEmpty(cc)) {
return (
cc.status === CHANGE_CONTROL_STATUS.COMPLETED || cc.status === CHANGE_CONTROL_STATUS.FAILED
);
}
return true;
}
return false;
}
cvprac version:
v1.0.7
cvp version tested:2021.3.0
When calling api.change_control_available_tasks() I would expect that only unassigned tasks are returned. Instead it looks like any tasks that are in the
workOrderUserDefinedStatus: Pending
state are returned.It looks like none of the ccId values are updated when a task is assigned to a CC e.g (taskId 20 is assigned to a CC).
But at the same time: