Skip to content

Commit

Permalink
Merge pull request #1319 from sgratch/avoid-negative-number-for-succe…
Browse files Browse the repository at this point in the history
…ssed-migrated-vms-count

🐞 Fix Negative number for plan/migration status  VMs count
  • Loading branch information
yaacov committed Sep 8, 2024
2 parents 7e85021 + 792730b commit 91ce362
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@ export const getMigrationVmsCounts = (vms: V1beta1PlanStatusMigrationVms[]): Mig
);
const vmsCompleted = vms.filter((vm) => vm?.completed);
const vmsError = vms.filter((vm) => vm?.error);
const success = vmsCompleted.length - vmsError.length - vmsCanceled.length;

return {
completed: vmsCompleted.length,
total: vms.length,
canceled: vmsCanceled.length,
error: vmsError.length,
success: vmsCompleted.length - vmsError.length - vmsCanceled.length,
success: success >= 0 ? success : 0,
};
};

Expand Down

0 comments on commit 91ce362

Please sign in to comment.