feat(hamlog): mark what has been sent, and a QSL Manager backlog
An upload now leaves a trace on the QSO: APP_OPSLOG_HAMLOG_SENT holds the day it went. The date rather than a Y, so a log says WHEN — and so one shape serves three readers: eligibility (a stamped QSO is not sent twice), the QSL Manager's backlog, and the appearance rules' sent channel. HAMLOG joins the QSL Manager's service list. It has no status column to select on, so its backlog is the ABSENCE of that extras key — a LIKE over the extras JSON, which is a full scan and is the right trade here: it answers a button an operator presses, and the alternative is a promoted column for a field no other program would ever read. The match is on the quoted key, so a QSO whose comment merely mentions the text is not taken for one already sent — which is what the test pins.
This commit is contained in:
@@ -143,3 +143,37 @@ func TestIDByDedupeKeyRecognisesTheSameContact(t *testing.T) {
|
||||
t.Error("an empty key matched a row")
|
||||
}
|
||||
}
|
||||
|
||||
// A service with no status column of its own — HAMLOG.online, whose field the
|
||||
// ADIF standard does not define — finds its backlog by the ABSENCE of an extras
|
||||
// key. The LIKE has to match the key, and only the key: a QSO whose comment
|
||||
// happens to contain the same text must not be mistaken for one already sent.
|
||||
func TestListMissingExtraMatchesTheKeyNotItsText(t *testing.T) {
|
||||
r := openRepo(t)
|
||||
ctx := context.Background()
|
||||
|
||||
sent := addQSO(t, r, "F4BPO", time.Date(2026, 1, 1, 12, 0, 0, 0, time.UTC))
|
||||
notSent, err := r.Add(ctx, QSO{
|
||||
Callsign: "F1TRF", QSODate: time.Date(2026, 1, 2, 12, 0, 0, 0, time.UTC),
|
||||
Band: "40m", Mode: "CW",
|
||||
Comment: "mentions APP_OPSLOG_HAMLOG_SENT in the text",
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := r.SetExtra(ctx, sent, "APP_OPSLOG_HAMLOG_SENT", "20260823"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
got, err := r.ListMissingExtra(ctx, "APP_OPSLOG_HAMLOG_SENT")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if len(got) != 1 || got[0].ID != notSent {
|
||||
ids := make([]int64, len(got))
|
||||
for i, q := range got {
|
||||
ids[i] = q.ID
|
||||
}
|
||||
t.Fatalf("backlog = %v, want just %d (the one never sent)", ids, notSent)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user