Skip to content

Commit

Permalink
chore(core): Use lists defined in JobStatus class instead of set
Browse files Browse the repository at this point in the history
Signed-off-by: Johanna Lamppu <johanna.lamppu@doubleopen.org>
  • Loading branch information
lamppu authored and sschuberth committed Dec 12, 2024
1 parent cfab321 commit e0fc56e
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions core/src/main/kotlin/api/RunsRoute.kt
Original file line number Diff line number Diff line change
Expand Up @@ -277,12 +277,10 @@ fun Route.runs() = route("runs") {

val jobs = repositoryService.getJobs(ortRun.repositoryId, ortRun.index)

val finishedStateSet: Set<JobStatus> = setOf(JobStatus.FINISHED, JobStatus.FINISHED_WITH_ISSUES)

val analyzerJobInFinalState = jobs?.analyzer?.status in finishedStateSet.plus(JobStatus.FAILED)
val analyzerJobInFinishedState = jobs?.analyzer?.status in finishedStateSet
val advisorJobInFinishedState = jobs?.advisor?.status in finishedStateSet
val evaluatorJobInFinishedState = jobs?.evaluator?.status in finishedStateSet
val analyzerJobInFinalState = jobs?.analyzer?.status in JobStatus.FINAL_STATUSES
val analyzerJobInFinishedState = jobs?.analyzer?.status in JobStatus.SUCCESSFUL_STATUSES
val advisorJobInFinishedState = jobs?.advisor?.status in JobStatus.SUCCESSFUL_STATUSES
val evaluatorJobInFinishedState = jobs?.evaluator?.status in JobStatus.SUCCESSFUL_STATUSES

val issuesCount = if (analyzerJobInFinalState) issueService.countForOrtRunId(ortRun.id) else null

Expand Down

0 comments on commit e0fc56e

Please sign in to comment.