Skip to content

Commit e2baae3

Browse files
author
anonymous
committed
Update table sort
1 parent 889d14c commit e2baae3

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

scripts/table.js

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@ async function displayData(data, metric, metricName) {
88
(el) => (el.innerHTML = metricName)
99
);
1010

11-
function display(el, cols) {
12-
flattened.sort(
13-
(a, b) =>
14-
cols.reduce((acc, key) => acc + b[key], 0) -
15-
cols.reduce((acc, key) => acc + a[key], 0)
16-
);
11+
function display(el, cols, sort_key) {
12+
// flattened.sort(
13+
// (a, b) =>
14+
// cols.reduce((acc, key) => acc + b[key], 0) -
15+
// cols.reduce((acc, key) => acc + a[key], 0)
16+
// );
17+
flattened.sort((a, b) => b[sort_key] - a[sort_key]);
1718

1819
const tbody = el.querySelector("tbody");
1920
tbody.innerHTML = "";
@@ -39,12 +40,16 @@ async function displayData(data, metric, metricName) {
3940
}
4041
}
4142

42-
display(tableClass, [
43-
"completion",
44-
"compilation_class_wise",
45-
"pass_class_wise",
46-
]);
47-
display(tableTest, ["compilation_test_wise", "pass_test_wise"]);
43+
display(
44+
tableClass,
45+
["completion", "compilation_class_wise", "pass_class_wise"],
46+
"pass_class_wise"
47+
);
48+
display(
49+
tableTest,
50+
["compilation_test_wise", "pass_test_wise"],
51+
"pass_test_wise"
52+
);
4853
}
4954

5055
btnMethod.addEventListener("click", () => {

0 commit comments

Comments
 (0)