From cdf89a0f411c4abebbf2bf30e36cfebdef25d212 Mon Sep 17 00:00:00 2001 From: Oliver Sanders Date: Tue, 14 Oct 2025 14:56:14 +0100 Subject: [PATCH] workflows: omit stopped workflows from cumulative state totals * Closes #1930 * Have purposefully left the "latest state tasks" logic unchanged as we are planning to remove this imminently. --- src/components/cylc/tree/GScanTreeItem.vue | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/components/cylc/tree/GScanTreeItem.vue b/src/components/cylc/tree/GScanTreeItem.vue index d29779b2d..eca4b386a 100644 --- a/src/components/cylc/tree/GScanTreeItem.vue +++ b/src/components/cylc/tree/GScanTreeItem.vue @@ -109,20 +109,26 @@ import { useWorkflowWarnings } from '@/composables/localStorage' * @param {Object} node * @param {Record} stateTotals * @param {Record} latestTasks + * @param {Boolean} topLevel - true if the traversal depth is 0, else false. */ -function traverseChildren (node, stateTotals = {}, latestTasks = {}) { +function traverseChildren (node, stateTotals = {}, latestTasks = {}, topLevel = true) { // if we aren't at the end of the node tree, continue recurse until we hit something other then a workflow part if (node.type === 'workflow-part' && node.children) { // at every branch, recurse all child nodes for (const child of node.children) { - traverseChildren(child, stateTotals, latestTasks) + traverseChildren(child, stateTotals, latestTasks, false) } } else if (node.type === 'workflow' && node.node.stateTotals) { // if we are at the end of a node (or at least, hit a workflow node), stop and merge state // the latest state tasks from this node with all the others from the tree for (const [state, totals] of Object.entries(node.node.stateTotals)) { - if (JobStateNames.includes(state)) { // filter only valid states + if ( + // filter only valid states + JobStateNames.includes(state) && + // omit state totals from stopped workflows + (topLevel || node.node.status !== 'stopped') + ) { // (cast as numbers so they dont get concatenated as strings) stateTotals[state] = (stateTotals[state] ?? 0) + parseInt(totals) }