@@ -13,9 +13,9 @@ import {useExpandedStore} from "../../utils/expansion";
1313import {
1414 BenchmarkRequest ,
1515 BenchmarkRequestStatus ,
16- BenchmarkJob ,
1716 CollectorConfig ,
1817 StatusResponse ,
18+ isJobComplete ,
1919} from " ./data" ;
2020import Collector from " ./collector.vue" ;
2121
@@ -123,30 +123,23 @@ function PullRequestLink({request}: {request: BenchmarkRequest}) {
123123 );
124124}
125125
126- // This works off the assumption that all of the collectors are working on the
127- // same request.
128126function getJobCompletion(
129127 req : BenchmarkRequest ,
130128 collectors : CollectorConfig []
131129) {
132- const sampleJob = collectors ?.[0 ]?.jobs ?.[0 ];
133- if (! sampleJob ) return " " ;
134- if (sampleJob .requestTag !== req .tag ) return " " ;
135-
136- const allJobs: BenchmarkJob [] = [];
137- for (const collector of collectors ) {
138- allJobs .push (... collector .jobs );
130+ const jobs = collectors
131+ .flatMap ((c ) => c .jobs )
132+ .filter ((j ) => j .requestTag === req .tag );
133+ if (jobs .length === 0 ) {
134+ return " " ;
139135 }
140- const completed = allJobs .reduce ((acc , job ) => {
141- if (job . status === " Failed " || job . status === " Success " ) {
136+ const completed = jobs .reduce ((acc , job ) => {
137+ if (isJobComplete ( job ) ) {
142138 acc += 1 ;
143139 }
144140 return acc ;
145141 }, 0 );
146- if (allJobs .length ) {
147- return ` ${completed } / ${allJobs .length } ` ;
148- }
149- return " " ;
142+ return ` ${completed } / ${jobs .length } ` ;
150143}
151144
152145const {toggleExpanded : toggleExpandedErrors, isExpanded : hasExpandedErrors} =
0 commit comments