feat: clean up and optimize FCP filter and highlighting logic

This commit is contained in:
2026-02-27 12:36:01 +01:00
parent ad8c6eaeca
commit be9e6ae4e5
3 changed files with 7 additions and 8 deletions

View File

@@ -2524,11 +2524,9 @@ $pagination_entity_name = "Vorbestellungen";
fcpData.sort((a, b) => {
if (a.id === "") return -1;
if (b.id === "") return 1;
// Sort by preorder_count descending
if ((b.preorder_count || 0) !== (a.preorder_count || 0)) {
return (b.preorder_count || 0) - (a.preorder_count || 0);
}
// Fallback to name-based numeric/alpha sort
const aN = a.id.replace(/\D/g, ""), bN = b.id.replace(/\D/g, "");
return aN && bN ? parseInt(aN, 10) - parseInt(bN, 10) : a.id.localeCompare(b.id);
});