Skip to content

Commit 93c1e09

Browse files
committed
feat: add duplicated submission to leaderboard
1 parent fd6e301 commit 93c1e09

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

src/components/leaderboard/Leaderboard.tsx

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,20 @@ const Leaderboard: React.FC<LeaderboardProps> = ({ benchmarkId }) => {
4141
return 1;
4242
}
4343
return 0;
44+
case 'duplicatedSubmissions':
45+
if (
46+
row1.duplicatedSubmissions?.length! <
47+
row2.duplicatedSubmissions?.length!
48+
) {
49+
return -1;
50+
}
51+
if (
52+
row1.duplicatedSubmissions?.length! >
53+
row2.duplicatedSubmissions?.length!
54+
) {
55+
return 1;
56+
}
57+
return 0;
4458
}
4559
return 0;
4660
}
@@ -226,6 +240,20 @@ const Leaderboard: React.FC<LeaderboardProps> = ({ benchmarkId }) => {
226240
/>
227241
</div>
228242
</th>
243+
<th
244+
scope="col"
245+
className="dark:text-gray-100 px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider"
246+
onClick={() => setSortedField('duplicatedSubmissions')}
247+
>
248+
<div className="flex">
249+
Duplicated submissions
250+
<img
251+
className="w-4 h-4 ml-2"
252+
alt="Sort by lint score"
253+
src="https://image.flaticon.com/icons/png/512/162/162735.png"
254+
/>
255+
</div>
256+
</th>
229257
</tr>
230258
</thead>
231259
<tbody className="bg-white dark:bg-gray-300 divide-y divide-gray-200 ">
@@ -285,6 +313,11 @@ const Leaderboard: React.FC<LeaderboardProps> = ({ benchmarkId }) => {
285313
<td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
286314
{row.execDuration}
287315
</td>
316+
<td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
317+
{row.duplicatedSubmissions
318+
? row.duplicatedSubmissions.length
319+
: 0}
320+
</td>
288321
</tr>
289322
))
290323
: ''}

src/components/leaderboard/LeaderboardModel.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export default class LeaderboardModel {
66
memUsage: number | undefined;
77
execDuration: number | undefined;
88
createdAt: string | undefined;
9+
duplicatedSubmissions: [] | undefined;
910
user:
1011
| {
1112
id: string | undefined;

0 commit comments

Comments
 (0)