feat(spot): put the award references in the spot comment

After the mode, which is the order a cluster line is read in:
"CW POTA FR-11553".

Two sources, because the QSO can be at either stage. While it is being typed
the entry panel holds the references as "CODE@REF;CODE@REF"; once logged they
live on the row as the materialised award_refs. The Send Spot window takes the
entry's when there are any and falls back to the last logged QSO — the same
fallback the callsign and frequency defaults already use — and picking a QSO
from the Latest list fills in that QSO's own.

A self-spot is the opposite case and gets its own builder: it announces OUR
station, so it carries MY_POTA_REF and friends. Using the QSO's award
references there would spot us with the park number of the station we just
worked, announcing us from somewhere we are not.

Both cap at the 30 characters a cluster node keeps, and add a reference whole
or not at all — a truncated park number is worse than none, since nobody can
act on it, and it still costs everyone who reads the spot. Only the comment we
BUILD is held to that; what the operator types is their own business.
This commit is contained in:
2026-08-14 13:22:21 +02:00
parent db87ef39c0
commit 4f9a366884
6 changed files with 159 additions and 8 deletions
+17
View File
@@ -154,3 +154,20 @@ export function buildAwardRefs(qso: any, pickable: Array<{ code: string; field:
}
return out.join(';');
}
// spotRefList turns a code→ref map into the strings a DX-cluster comment wants:
// ["POTA FR-11553", "IOTA EU-064"]. A code carrying several references (a
// two-fer park activation) yields one entry per reference, so a spot can carry
// the one that fits and drop the rest rather than emitting a truncated pair.
//
// Shortest first: cluster comments are 30 characters, and when they do not all
// fit, more references beat fewer.
export function spotRefList(byCode: Record<string, string>): string[] {
const out: string[] = [];
for (const [code, refs] of Object.entries(byCode ?? {})) {
for (const ref of String(refs).split(',').map((s) => s.trim()).filter(Boolean)) {
out.push(`${code.toUpperCase()} ${ref.toUpperCase()}`);
}
}
return out.sort((a, b) => a.length - b.length || a.localeCompare(b));
}