Skip to content

Commit 2fa4ce0

Browse files
committed
fix: sorting ranking columns by its value
1 parent 7e9e3fe commit 2fa4ce0

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

frontend/src/pages/ModelRankingPage.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,20 +57,20 @@ const columns: ColumnsType<RankingEntry> = [
5757
dataIndex: 'mean_coverage',
5858
key: 'mean_coverage',
5959
render: (v: number) => v.toFixed(4),
60-
sorter: (a, b) => b.mean_coverage - a.mean_coverage,
60+
sorter: (a, b) => a.mean_coverage - b.mean_coverage,
6161
},
6262
{
6363
title: 'Median Coverage',
6464
dataIndex: 'median_coverage',
6565
key: 'median_coverage',
6666
render: (v: number) => v.toFixed(4),
67-
sorter: (a, b) => b.mean_coverage - a.mean_coverage,
67+
sorter: (a, b) => a.median_coverage - b.median_coverage,
6868
},
6969
{
7070
title: 'Total Tests',
7171
dataIndex: 'total_tests',
7272
key: 'total_tests',
73-
sorter: (a, b) => b.mean_coverage - a.mean_coverage,
73+
sorter: (a, b) => a.total_tests - b.total_tests,
7474
},
7575
{
7676
title: 'Errors',
@@ -79,21 +79,22 @@ const columns: ColumnsType<RankingEntry> = [
7979
render: (v: number) => (
8080
<span style={{ color: v > 0 ? '#ff4d4f' : 'inherit' }}>{v}</span>
8181
),
82-
sorter: (a, b) => b.mean_coverage - a.mean_coverage,
82+
sorter: (a, b) => a.total_errors - b.total_errors,
8383
},
8484
{
8585
title: 'Time (s)',
8686
dataIndex: 'total_time_sec',
8787
key: 'total_time_sec',
8888
render: (v: number) => v.toFixed(2),
89-
sorter: (a, b) => b.mean_coverage - a.mean_coverage,
89+
sorter: (a, b) => a.total_time_sec - b.total_time_sec,
9090
},
9191
{
9292
title: 'Published',
9393
dataIndex: 'created_at',
9494
key: 'created_at',
9595
render: (v: string) => new Date(v).toLocaleDateString(),
96-
sorter: (a, b) => b.mean_coverage - a.mean_coverage,
96+
sorter: (a, b) =>
97+
new Date(a.created_at).getTime() - new Date(b.created_at).getTime(),
9798
},
9899
];
99100

0 commit comments

Comments
 (0)