Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
Commit ·
2a764c7
1
Parent(s): f20c7d0
rank mode dynamic with filters and sorting
Browse files- frontend/leaderboard.html +14 -7
frontend/leaderboard.html
CHANGED
|
@@ -723,7 +723,7 @@
|
|
| 723 |
<div
|
| 724 |
class="tooltip-content invisible opacity-0 absolute bottom-full left-1/2 -translate-x-1/2 mb-2 w-48 p-2 bg-slate-800 text-white text-xs rounded shadow-lg transition-all z-50 text-left pointer-events-none">
|
| 725 |
<p>
|
| 726 |
-
<strong>
|
| 727 |
<strong>Current View Rank:</strong> updates the rank based on the current sort and filters.
|
| 728 |
</p>
|
| 729 |
<div
|
|
@@ -735,7 +735,7 @@
|
|
| 735 |
</h4>
|
| 736 |
<div class="flex flex-wrap gap-1.5">
|
| 737 |
<button onclick="window.setRankMode('static')" id="rankBtnStatic"
|
| 738 |
-
class="px-3 py-1.5 rounded-lg border text-xs font-medium cursor-pointer transition-all select-none bg-indigo-50 border-indigo-400 text-indigo-600 dark:bg-indigo-900/30 dark:border-indigo-500 dark:text-indigo-300">
|
| 739 |
<button onclick="window.setRankMode('dynamic')" id="rankBtnDynamic"
|
| 740 |
class="px-3 py-1.5 rounded-lg border text-xs font-medium cursor-pointer transition-all select-none bg-white border-slate-200 text-slate-500 hover:bg-slate-50 dark:bg-slate-700 dark:border-slate-600 dark:text-slate-300 dark:hover:bg-slate-600">Current View Rank</button>
|
| 741 |
</div>
|
|
@@ -1168,6 +1168,7 @@ taskTypes: [], // [] = All; otherwise selected subset
|
|
| 1168 |
tableOptions.avgMode = 'all';
|
| 1169 |
tableOptions.taskTypes = [];
|
| 1170 |
tableOptions.domains = [];
|
|
|
|
| 1171 |
// Restore all benchmark columns that were hidden by filters
|
| 1172 |
tableColumns.forEach(col => {
|
| 1173 |
if (EVAL_COLUMNS.includes(col.id)) col.hidden = false;
|
|
@@ -1250,7 +1251,9 @@ setupFilterPills();
|
|
| 1250 |
tableOptions.taskTypes = [];
|
| 1251 |
}
|
| 1252 |
const hasFilters = tableOptions.taskTypes.length > 0 || tableOptions.domains.length > 0;
|
| 1253 |
-
tableOptions.avgMode
|
|
|
|
|
|
|
| 1254 |
applyColumnFilters();
|
| 1255 |
updateOptionUI();
|
| 1256 |
prepareColumns(lbData);
|
|
@@ -1268,7 +1271,9 @@ setupFilterPills();
|
|
| 1268 |
tableOptions.domains = [];
|
| 1269 |
}
|
| 1270 |
const hasFilters = tableOptions.taskTypes.length > 0 || tableOptions.domains.length > 0;
|
| 1271 |
-
tableOptions.avgMode
|
|
|
|
|
|
|
| 1272 |
applyColumnFilters();
|
| 1273 |
updateOptionUI();
|
| 1274 |
prepareColumns(lbData);
|
|
@@ -1884,9 +1889,11 @@ window.toggleExpandText = function (idBase, btn) {
|
|
| 1884 |
|
| 1885 |
// 4. Handle Ranking Mode
|
| 1886 |
if (tableOptions.rankMode === 'dynamic') {
|
| 1887 |
-
|
| 1888 |
-
|
| 1889 |
-
|
|
|
|
|
|
|
| 1890 |
}
|
| 1891 |
|
| 1892 |
// 5. Update Grid
|
|
|
|
| 723 |
<div
|
| 724 |
class="tooltip-content invisible opacity-0 absolute bottom-full left-1/2 -translate-x-1/2 mb-2 w-48 p-2 bg-slate-800 text-white text-xs rounded shadow-lg transition-all z-50 text-left pointer-events-none">
|
| 725 |
<p>
|
| 726 |
+
<strong>Global Rank:</strong> shows the rank based on the global average across all benchmarks.<br>
|
| 727 |
<strong>Current View Rank:</strong> updates the rank based on the current sort and filters.
|
| 728 |
</p>
|
| 729 |
<div
|
|
|
|
| 735 |
</h4>
|
| 736 |
<div class="flex flex-wrap gap-1.5">
|
| 737 |
<button onclick="window.setRankMode('static')" id="rankBtnStatic"
|
| 738 |
+
class="px-3 py-1.5 rounded-lg border text-xs font-medium cursor-pointer transition-all select-none bg-indigo-50 border-indigo-400 text-indigo-600 dark:bg-indigo-900/30 dark:border-indigo-500 dark:text-indigo-300">Global Rank</button>
|
| 739 |
<button onclick="window.setRankMode('dynamic')" id="rankBtnDynamic"
|
| 740 |
class="px-3 py-1.5 rounded-lg border text-xs font-medium cursor-pointer transition-all select-none bg-white border-slate-200 text-slate-500 hover:bg-slate-50 dark:bg-slate-700 dark:border-slate-600 dark:text-slate-300 dark:hover:bg-slate-600">Current View Rank</button>
|
| 741 |
</div>
|
|
|
|
| 1168 |
tableOptions.avgMode = 'all';
|
| 1169 |
tableOptions.taskTypes = [];
|
| 1170 |
tableOptions.domains = [];
|
| 1171 |
+
currentSort = { colId: null, dir: 'none' };
|
| 1172 |
// Restore all benchmark columns that were hidden by filters
|
| 1173 |
tableColumns.forEach(col => {
|
| 1174 |
if (EVAL_COLUMNS.includes(col.id)) col.hidden = false;
|
|
|
|
| 1251 |
tableOptions.taskTypes = [];
|
| 1252 |
}
|
| 1253 |
const hasFilters = tableOptions.taskTypes.length > 0 || tableOptions.domains.length > 0;
|
| 1254 |
+
tableOptions.avgMode = hasFilters ? 'visible' : 'all';
|
| 1255 |
+
tableOptions.rankMode = hasFilters ? 'dynamic' : 'static';
|
| 1256 |
+
if (hasFilters) currentSort = { colId: 'Average', dir: 'asc' };
|
| 1257 |
applyColumnFilters();
|
| 1258 |
updateOptionUI();
|
| 1259 |
prepareColumns(lbData);
|
|
|
|
| 1271 |
tableOptions.domains = [];
|
| 1272 |
}
|
| 1273 |
const hasFilters = tableOptions.taskTypes.length > 0 || tableOptions.domains.length > 0;
|
| 1274 |
+
tableOptions.avgMode = hasFilters ? 'visible' : 'all';
|
| 1275 |
+
tableOptions.rankMode = hasFilters ? 'dynamic' : 'static';
|
| 1276 |
+
if (hasFilters) currentSort = { colId: 'Average', dir: 'asc' };
|
| 1277 |
applyColumnFilters();
|
| 1278 |
updateOptionUI();
|
| 1279 |
prepareColumns(lbData);
|
|
|
|
| 1889 |
|
| 1890 |
// 4. Handle Ranking Mode
|
| 1891 |
if (tableOptions.rankMode === 'dynamic') {
|
| 1892 |
+
// Rank is always quality-based (rank 1 = best Average),
|
| 1893 |
+
// independent of display sort direction.
|
| 1894 |
+
const byQuality = [...filtered].sort((a, b) => parseFloat(b['Average']) - parseFloat(a['Average']));
|
| 1895 |
+
const rankMap = new Map(byQuality.map((row, i) => [row, i + 1]));
|
| 1896 |
+
filtered.forEach(row => { row['Rank'] = rankMap.get(row) ?? filtered.length; });
|
| 1897 |
}
|
| 1898 |
|
| 1899 |
// 5. Update Grid
|