fix(import): a deleted DXCC entity is not re-stamped from cty.dat

Reported with a Logger32 export: the record said <DXCC:3>151 and OpsLog
stored 54.

cty.dat answers one question — where is this callsign TODAY — and that is
the wrong question for a log. R1MVI was Malyj Vysotskij Island, entity
151, until the ARRL deleted it in 2012; the same call resolves to European
Russia today. Forcing the lookup onto a 2004 contact therefore destroys a
credit that can NEVER be worked again, because the place no longer counts.

So the ADIF's number wins whenever it names a deleted entity, and nothing
is corrected on those records at all — the country name and the zones of a
deleted entity are equally beyond what a present-day prefix table knows.
The list is the ADIF specification's own enumeration, sixty-odd entities
that only change when the ARRL deletes another one.

The guard sits in the forced path, so it also covers the grid's 'Update
from cty.dat' on a selection — the other way an operator could have lost
the same credits, one right-click at a time.
This commit is contained in:
2026-08-26 21:59:53 +02:00
parent 4a28b51ade
commit c1cd76bbcf
4 changed files with 162 additions and 2 deletions
+15
View File
@@ -12739,6 +12739,21 @@ func (a *App) enrichContactedFromCtyForce(q *qso.QSO) bool {
if a.dxcc == nil || q.Callsign == "" {
return false
}
// A DELETED ENTITY IS LEFT ALONE, whatever cty.dat says about the callsign
// today.
//
// cty.dat answers "where is this call now". For a contact made before an
// entity was deleted that is the wrong question: R1MVI was Malyj Vysotskij
// (151) until 2012 and resolves to European Russia (54) today, so forcing
// the lookup onto a 2004 QSO destroys a credit that can never be worked
// again — the place does not exist to be worked. Reported from a Logger32
// export whose <DXCC:3>151 came back as 54.
//
// Nothing is corrected here rather than only the number: the country name
// and the zones of a deleted entity are equally beyond cty.dat's knowledge.
if q.DXCC != nil && dxcc.IsDeleted(*q.DXCC) {
return false
}
m, ok := a.dxcc.Lookup(q.Callsign)
if !ok || m.Entity == nil {
return false