From: Mateusz Warowny Date: Fri, 25 Mar 2022 17:35:04 +0000 (+0100) Subject: JAL-3878 Fix task status precedence calculation X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=e1e1e08937f1570548cbee18d6746ec43496664e;p=jalview.git JAL-3878 Fix task status precedence calculation Task status could only go up from the current status. --- diff --git a/src/jalview/ws2/actions/AbstractPollableTask.java b/src/jalview/ws2/actions/AbstractPollableTask.java index 1e57556..999411f 100644 --- a/src/jalview/ws2/actions/AbstractPollableTask.java +++ b/src/jalview/ws2/actions/AbstractPollableTask.java @@ -207,19 +207,18 @@ public abstract class AbstractPollableTask implements Task */ private void updateGlobalStatus() { - JobStatus newStatus = taskStatus; - int currentPrecedence = ArrayUtils.indexOf(statusPrecedence, newStatus); + int precedence = -1; for (BaseJob job : jobs) { JobStatus status = job.getStatus(); int jobPrecedence = ArrayUtils.indexOf(statusPrecedence, status); - if (currentPrecedence < jobPrecedence) - { - currentPrecedence = jobPrecedence; - newStatus = status; - } + if (precedence < jobPrecedence) + precedence = jobPrecedence; + } + if (precedence >= 0) + { + setStatus(statusPrecedence[precedence]); } - setStatus(newStatus); } /**