Ver Fonte

Fix some instances where tasks are not sorted

When having multiple RUNNING tasks, sorting may not be properly done for
the first replica in the list of replicas.
Sergiu Miclea há 6 anos atrás
pai
commit
0797110433
1 ficheiros alterados com 3 adições e 6 exclusões
  1. 3 6
      src/sources/ReplicaSource.js

+ 3 - 6
src/sources/ReplicaSource.js

@@ -79,14 +79,11 @@ class ReplicaSourceUtils {
   }
   }
 
 
   static sortReplicas(replicas) {
   static sortReplicas(replicas) {
-    if (replicas.length === 1) {
-      ReplicaSourceUtils.sortExecutions(replicas[0].executions)
-      return
-    }
+    replicas.forEach(replica => {
+      ReplicaSourceUtils.sortExecutionsAndTasks(replica.executions)
+    })
 
 
     replicas.sort((a, b) => {
     replicas.sort((a, b) => {
-      ReplicaSourceUtils.sortExecutionsAndTasks(a.executions)
-      ReplicaSourceUtils.sortExecutionsAndTasks(b.executions)
       let aLastExecution = a.executions && a.executions.length ? a.executions[a.executions.length - 1] : null
       let aLastExecution = a.executions && a.executions.length ? a.executions[a.executions.length - 1] : null
       let bLastExecution = b.executions && b.executions.length ? b.executions[b.executions.length - 1] : null
       let bLastExecution = b.executions && b.executions.length ? b.executions[b.executions.length - 1] : null
       let aLastTime = aLastExecution ? aLastExecution.updated_at || aLastExecution.created_at : null
       let aLastTime = aLastExecution ? aLastExecution.updated_at || aLastExecution.created_at : null