@@ -109,20 +109,26 @@ import { useWorkflowWarnings } from '@/composables/localStorage'
109109 * @param {Object} node
110110 * @param {Record<string, number>} stateTotals
111111 * @param {Record<string, string[]>} latestTasks
112+ * @param {Boolean} topLevel - true if the traversal depth is 0, else false.
112113 */
113- function traverseChildren (node , stateTotals = {}, latestTasks = {}) {
114+ function traverseChildren (node , stateTotals = {}, latestTasks = {}, topLevel = true ) {
114115 // if we aren't at the end of the node tree, continue recurse until we hit something other then a workflow part
115116 if (node .type === ' workflow-part' && node .children ) {
116117 // at every branch, recurse all child nodes
117118 for (const child of node .children ) {
118- traverseChildren (child, stateTotals, latestTasks)
119+ traverseChildren (child, stateTotals, latestTasks, false )
119120 }
120121 } else if (node .type === ' workflow' && node .node .stateTotals ) {
121122 // if we are at the end of a node (or at least, hit a workflow node), stop and merge state
122123
123124 // the latest state tasks from this node with all the others from the tree
124125 for (const [state , totals ] of Object .entries (node .node .stateTotals )) {
125- if (JobStateNames .includes (state)) { // filter only valid states
126+ if (
127+ // filter only valid states
128+ JobStateNames .includes (state) &&
129+ // omit state totals from stopped workflows
130+ (topLevel || node .node .status !== ' stopped' )
131+ ) {
126132 // (cast as numbers so they dont get concatenated as strings)
127133 stateTotals[state] = (stateTotals[state] ?? 0 ) + parseInt (totals)
128134 }
0 commit comments