Opt-in, off by default: neither service can undo it, and a local delete is not
always a statement about the world — a duplicate cleared out of a contest log
was never meant to change the DX's log.
The two APIs are not alike, and the difference decides what is possible:
- Club Log deletes by MATCH (callsign, exact timestamp, band number), so it
works for every QSO in the log, past or future. The band table is its own
list and is pinned by a test: a band mapped to the wrong number does not
fail, it points the delete at a different QSO.
- QRZ.com deletes ONLY by logid. So markExtUploaded now stores the LOGID it
already received on every upload — it was being logged and thrown away. A
QSO uploaded before this cannot be withdrawn from here at all, and the log
says so by name rather than leaving the operator to assume it worked.
Both run BEFORE the local delete, because both need the QSO's own fields to
find their copy and there is nothing left to ask with once the row is gone.
Neither can block it: the operator asked for the QSO to go, and a refusing
website is not a reason to keep it.
33 lines
1.1 KiB
Go
33 lines
1.1 KiB
Go
package extsvc
|
|
|
|
import "testing"
|
|
|
|
// Club Log matches a deletion on callsign, exact time and BAND NUMBER. A band
|
|
// that maps to the wrong number does not fail — it points the delete at a
|
|
// different QSO, or at nothing, silently. So the table is pinned.
|
|
func TestClublogBandID(t *testing.T) {
|
|
for _, c := range []struct {
|
|
band string
|
|
want int
|
|
}{
|
|
{"160m", 160}, {"80m", 80}, {"60m", 60}, {"40m", 40}, {"30m", 30},
|
|
{"20m", 20}, {"17m", 17}, {"15m", 15}, {"12m", 12}, {"10m", 10},
|
|
{"6m", 6}, {"4m", 4}, {"2m", 2},
|
|
{"70cm", 70}, {"23cm", 23}, {"13cm", 13},
|
|
{"20M", 20}, {" 20m ", 20}, // ADIF case and stray spaces
|
|
} {
|
|
got, ok := clublogBandID(c.band)
|
|
if !ok || got != c.want {
|
|
t.Errorf("clublogBandID(%q) = %d,%v — want %d", c.band, got, ok, c.want)
|
|
}
|
|
}
|
|
|
|
// Bands Club Log does not accept must be REFUSED, never approximated to a
|
|
// neighbour: 6 cm silently becoming 13 cm would delete somebody else's QSO.
|
|
for _, bad := range []string{"", "6cm", "3cm", "2200m", "630m", "9cm", "banana"} {
|
|
if id, ok := clublogBandID(bad); ok {
|
|
t.Errorf("clublogBandID(%q) accepted as %d — it is not a Club Log band", bad, id)
|
|
}
|
|
}
|
|
}
|