修复百分比排序

This commit is contained in:
2026-04-22 03:02:02 +08:00
parent eb49309058
commit 4283d4fc13

View File

@@ -109,7 +109,7 @@ function applyPercentileFilter() {
} }
const rows = document.getElementById('rankingList').querySelectorAll('tr'); const rows = document.getElementById('rankingList').querySelectorAll('tr');
if (rows.length === 0) return; if (rows.length === 0) return;
const showCount = Math.ceil(totalStudents * (percentile / 100)); const showCount = Math.max(1, Math.floor(totalStudents * (percentile / 100)));
rows.forEach(function(row, index) { rows.forEach(function(row, index) {
row.style.display = index < showCount ? '' : 'none'; row.style.display = index < showCount ? '' : 'none';
}); });