Sort all filter columns: matched entries first, then unmatched, both alphabetical

This commit is contained in:
Pontoporeia
2026-06-24 11:32:11 +02:00
parent 982d91345d
commit 3c786b037a

View File

@@ -111,11 +111,15 @@ foreach ($filterColumns as $col) {
<div id="repertoire-index" class="repertoire-index">
<?php
// Sort keywords: matched first (alpha), then unmatched (alpha) — keeps viable
// tags at the top so users don't have to scroll past faded entries.
usort($repData['keywords'], fn($a, $b) =>
($b['matched'] <=> $a['matched']) ?: strcasecmp($a['value'], $b['value'])
);
// Sort filter columns: matched first (alpha), then unmatched (alpha) — keeps
// viable entries at the top so users don't have to scroll past faded ones.
$sortMatchedFirst = fn($a, $b) =>
($b['matched'] <=> $a['matched']) ?: strcasecmp($a['value'], $b['value']);
usort($repData['years'], $sortMatchedFirst);
usort($repData['ap_programs'], $sortMatchedFirst);
usort($repData['orientations'], $sortMatchedFirst);
usort($repData['finality_types'], $sortMatchedFirst);
usort($repData['keywords'], $sortMatchedFirst);
// Render filter columns in the correct left-to-right order.
// Students column (non-filter) is inserted between keywords and AP/or/fi/years.