Truncate grid display to 4 characters for VUCC awards

For VUCC awards, ensure the grid square is truncated to 4 characters
both when counting unique entities AND when displaying.

This fixes VUCC award details to show 'FN31' instead of 'FN31pr',
making it clear that we're counting unique 4-character grid squares.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-16 09:16:24 +01:00
parent 052f0d13bd
commit f9283cd632

View File

@@ -283,7 +283,12 @@ export async function getAwardEntityBreakdown(userId, awardId) {
// Use displayField from award rules, or fallback to entity/type
let displayName = String(entity);
if (rules.displayField) {
displayName = String(qso[rules.displayField] || entity);
let rawValue = qso[rules.displayField];
// For grid-based awards, truncate to first 4 characters
if (rules.displayField === 'grid' && rawValue && rawValue.length > 4) {
rawValue = rawValue.substring(0, 4);
}
displayName = String(rawValue || entity);
} else {
// Fallback: try entity, state, grid, callsign in order
displayName = qso.entity || qso.state || qso.grid || qso.callsign || String(entity);