docs: say that the import option also fills the confirmation statuses

Asked for as a missing feature. It is not missing — the "fill my station fields"
option has stamped the default QSL / LoTW / eQSL / Club Log / HRDLog / QRZ.com
statuses on empty fields since v0.14. What was missing is any mention of it: the
option's description talked only about MY_* fields, so the behaviour was
undiscoverable except by comparing a log before and after.

The description now says it, in both languages, and names why it matters — a
WSJT-X log carries almost no QSL fields.

The rule is also pinned by a test now, which meant splitting the fill from the
settings lookup: blanks are filled, existing values are never touched.
Overwriting them would erase confirmations the operator has actually received,
and that is the half a future edit is most likely to get wrong.
This commit is contained in:
2026-07-29 17:56:10 +02:00
parent 5d7a9a9562
commit 482f81fe45
4 changed files with 95 additions and 33 deletions
+63
View File
@@ -0,0 +1,63 @@
package main
import (
"testing"
"hamlog/internal/qso"
)
// The confirmation statuses an import fills in, and the ones it must not touch.
//
// An operator asked for this feature believing it missing — it has been there
// since v0.14, but the option's description never mentioned it, so nobody could
// know. The behaviour is pinned here so a future edit cannot quietly drop what
// the description now promises.
//
// The rule is fill-if-empty: a WSJT-X log carries almost no QSL fields, while a
// log exported from another program carries real ones that must survive.
func TestQSLDefaultsFillOnlyEmptyFields(t *testing.T) {
defaults := QSLDefaults{
QSLSent: "N", QSLRcvd: "N",
LOTWSent: "N", LOTWRcvd: "N",
EQSLSent: "N", EQSLRcvd: "N",
ClublogStatus: "N", HRDLogStatus: "N",
QRZComStatus: "N", QRZComCfm: "N",
}
// A record as WSJT-X writes it: no confirmation fields at all.
bare := &qso.QSO{Callsign: "F4XYZ"}
applyQSLDefaultsTo(bare, defaults)
for name, got := range map[string]string{
"qsl_sent": bare.QSLSent, "qsl_rcvd": bare.QSLRcvd,
"lotw_sent": bare.LOTWSent, "lotw_rcvd": bare.LOTWRcvd,
"eqsl_sent": bare.EQSLSent, "eqsl_rcvd": bare.EQSLRcvd,
"clublog": bare.ClublogUploadStatus, "hrdlog": bare.HRDLogUploadStatus,
"qrz_sent": bare.QRZComUploadStatus, "qrz_rcvd": bare.QRZComDownloadStatus,
} {
if got != "N" {
t.Errorf("%s = %q on an empty record, want the default \"N\"", name, got)
}
}
// A record that already carries confirmations — from a real logbook export.
// Overwriting these would erase QSLs the operator has actually received.
kept := &qso.QSO{
Callsign: "F4XYZ",
QSLRcvd: "Y", LOTWRcvd: "Y", EQSLSent: "Y",
ClublogUploadStatus: "Y", QRZComDownloadStatus: "Y",
}
applyQSLDefaultsTo(kept, defaults)
for name, got := range map[string]string{
"qsl_rcvd": kept.QSLRcvd, "lotw_rcvd": kept.LOTWRcvd, "eqsl_sent": kept.EQSLSent,
"clublog": kept.ClublogUploadStatus, "qrz_rcvd": kept.QRZComDownloadStatus,
} {
if got != "Y" {
t.Errorf("%s = %q — an existing confirmation was overwritten", name, got)
}
}
// …while its empty ones still get the default.
if kept.QSLSent != "N" || kept.LOTWSent != "N" {
t.Errorf("empty fields on a partly-filled record were not defaulted: qsl_sent=%q lotw_sent=%q",
kept.QSLSent, kept.LOTWSent)
}
}