Ver Fonte

Fix execution sorting if there's only one replica

If there's only one replica in the replica list, execution sorting
would not trigger, thus replica may appear with `COMPLETED` status even
though the last execution was not successful.
Sergiu Miclea há 8 anos atrás
pai
commit
10489e3cc5
1 ficheiros alterados com 5 adições e 0 exclusões
  1. 5 0
      src/sources/ReplicaSource.js

+ 5 - 0
src/sources/ReplicaSource.js

@@ -36,6 +36,11 @@ class ReplicaSourceUtils {
   }
 
   static sortReplicas(replicas) {
+    if (replicas.length === 1) {
+      ReplicaSourceUtils.sortExecutions(replicas[0].executions)
+      return
+    }
+
     replicas.sort((a, b) => {
       ReplicaSourceUtils.sortExecutions(a.executions)
       ReplicaSourceUtils.sortExecutions(b.executions)