Skip to content

Commit

Permalink
add one helper to job utils
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewThien committed Dec 5, 2024
1 parent ee9d10a commit 33e7698
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions app/next-client-app/components/jobs/JobUtils.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
export const FindGeneralStatus = (jobsData: Job[]) => {
let generalStatus = "NOT_STARTED";
if (jobsData.length > 0) {
if (
jobsData?.some((job) => job.status && job.status.value === "IN_PROGRESS")
) {
generalStatus = "IN_PROGRESS";
} else if (
jobsData?.some((job) => job.status && job.status.value === "FAILED")
) {
generalStatus = "FAILED";
} else if (
jobsData?.every((job) => job.status && job.status.value === "COMPLETE")
) {
generalStatus = "COMPLETE";
}
}
return generalStatus;
};

0 comments on commit 33e7698

Please sign in to comment.