Skip to content

Commit 7407fb1

Browse files
committed
fixed comparison table bug when queries were unselected and showing 0
Co-authored by: jwagner988 jwagner988@gmail.com Co-authored by: mimiwrp mimiwirapa@gmail.com Co-authored by: ericJH92 eric.j.h92@gmail.com Co-authored-by: JuiceBawks betasnetwork@gmail.com
1 parent f9c0ad2 commit 7407fb1

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

frontend/components/views/CompareView/CompareTable.tsx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,17 @@ const tableInfo: InfoColumn[] = [
6464
['', 'center', (q: AnalysedQuery) => (q.isFastest ? <FastestMarker /> : '')],
6565
];
6666

67+
// Callback function for getFastestPerGroup
68+
function fastestCallback (acc, q) {
69+
if (getTotalTime(q) === 0) {return acc}
70+
return {
71+
...acc,
72+
[q.group]: Math.min(acc[q.group] ?? Infinity, getTotalTime(q))
73+
};
74+
};
75+
6776
const getFastestPerGroup = (queries: QueryData[]) =>
68-
queries.reduce<Record<string, number>>(
69-
(acc, q) => ({
70-
...acc,
71-
[q.group]: Math.min(acc[q.group] ?? Infinity, getTotalTime(q)),
72-
}),
73-
{}
74-
);
77+
queries.reduce<Record<string, number>>( fastestCallback, {} );
7578

7679
const analyze = (queries: QueryData[]): AnalysedQuery[] => {
7780
// fastest query in each group

0 commit comments

Comments
 (0)