Fix entity sorting when entity is a number
Convert entity to string before calling localeCompare to handle numeric entity IDs (like DXCC entityId values). Fixes TypeError on award detail pages when sorting by name. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -66,7 +66,11 @@
|
|||||||
// Apply sorting
|
// Apply sorting
|
||||||
switch (sort) {
|
switch (sort) {
|
||||||
case 'name':
|
case 'name':
|
||||||
filtered.sort((a, b) => (a.entity || '').localeCompare(b.entity || ''));
|
filtered.sort((a, b) => {
|
||||||
|
const aName = String(a.entity || '');
|
||||||
|
const bName = String(b.entity || '');
|
||||||
|
return aName.localeCompare(bName);
|
||||||
|
});
|
||||||
break;
|
break;
|
||||||
case 'status':
|
case 'status':
|
||||||
filtered.sort((a, b) => {
|
filtered.sort((a, b) => {
|
||||||
@@ -74,7 +78,9 @@
|
|||||||
if (!a.confirmed && b.confirmed) return 1;
|
if (!a.confirmed && b.confirmed) return 1;
|
||||||
if (a.worked && !b.worked) return -1;
|
if (a.worked && !b.worked) return -1;
|
||||||
if (!a.worked && b.worked) return 1;
|
if (!a.worked && b.worked) return 1;
|
||||||
return (a.entity || '').localeCompare(b.entity || '');
|
const aName = String(a.entity || '');
|
||||||
|
const bName = String(b.entity || '');
|
||||||
|
return aName.localeCompare(bName);
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user