fix: use smart default for displayField based on entityType
When displayField is omitted in award definitions, the backend now selects the appropriate default field based on the entityType: - dxcc → entity (country name) - state → state - grid → grid (4-character) - callsign → callsign Previously, it used a fixed fallback order that prioritized entity over other fields, causing grid-based awards to show DXCC names. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -896,7 +896,19 @@ export async function getAwardEntityBreakdown(userId, awardId) {
|
||||
}
|
||||
displayName = String(rawValue || entity);
|
||||
} else {
|
||||
displayName = qso.entity || qso.state || qso.grid || qso.callsign || String(entity);
|
||||
// Smart default based on entityType when displayField is not specified
|
||||
const defaultDisplayField = {
|
||||
'dxcc': 'entity',
|
||||
'state': 'state',
|
||||
'grid': 'grid',
|
||||
'callsign': 'callsign'
|
||||
}[rules.entityType] || 'entity';
|
||||
|
||||
let rawValue = qso[defaultDisplayField];
|
||||
if (defaultDisplayField === 'grid' && rawValue && rawValue.length > 4) {
|
||||
rawValue = rawValue.substring(0, 4);
|
||||
}
|
||||
displayName = String(rawValue || entity);
|
||||
}
|
||||
|
||||
if (!slotMap.has(slotKey)) {
|
||||
|
||||
Reference in New Issue
Block a user