fix(hamlog): read the site's own confirmation field, not a guessed one
A real record from their export settles it: <CALL:4>RL6M … <CNTY:5>RO-19 <APP_HAMLOG_R150COUNTRY:6>Russia <APP_HAMLOG_QSO_CFM:1>Y The confirmation lives in APP_HAMLOG_QSO_CFM. The four names guessed before a file was available — APP_HAMLOG_QSL and friends — were all wrong, which is the argument for reading one rather than reasoning about it. So that becomes the canonical key everywhere: the award source, the row colours, the grid column and the bulk editor. Importing a log downloaded from HAMLOG now carries its confirmations into OpsLog with nothing to rename. The older names, including the APP_OPSLOG_HAMLOG_QSL that OpsLog itself wrote in the meantime, are still honoured on read so nothing already stamped stops counting.
This commit is contained in:
@@ -95,3 +95,30 @@ func TestHamlogConfirmationSource(t *testing.T) {
|
||||
t.Error("a hamlog confirmation counted for an award that only accepts LoTW")
|
||||
}
|
||||
}
|
||||
|
||||
// The field name is theirs, taken from a real export:
|
||||
//
|
||||
// <APP_HAMLOG_QSO_CFM:1>Y
|
||||
//
|
||||
// Pinned as a test because it was GUESSED wrong first — an import that carries
|
||||
// its confirmations into OpsLog with nothing to rename is the whole point, and
|
||||
// a renamed constant would break it in silence.
|
||||
func TestHamlogUsesTheSitesOwnFieldName(t *testing.T) {
|
||||
if HamlogQSLKey != "APP_HAMLOG_QSO_CFM" {
|
||||
t.Fatalf("HamlogQSLKey = %q — their export writes APP_HAMLOG_QSO_CFM", HamlogQSLKey)
|
||||
}
|
||||
def := Def{Confirm: []string{"hamlog"}}
|
||||
// The record as HAMLOG exports it.
|
||||
q := &qso.QSO{Extras: map[string]string{
|
||||
"APP_HAMLOG_R150COUNTRY": "Russia",
|
||||
"APP_HAMLOG_QSO_CFM": "Y",
|
||||
}}
|
||||
if !Confirmed(q, def, def.Confirm) {
|
||||
t.Error("a real HAMLOG export did not confirm")
|
||||
}
|
||||
// Anything OpsLog stamped before that export existed keeps counting.
|
||||
old := &qso.QSO{Extras: map[string]string{"APP_OPSLOG_HAMLOG_QSL": "Y"}}
|
||||
if !Confirmed(old, def, def.Confirm) {
|
||||
t.Error("a QSO stamped with the older key stopped counting")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user