Files
OpsLog/internal/lookup/qrz_iota_test.go
T
rouggy 747c2b9105 feat(lookup): read QRZ's island reference and fill the IOTA award
QRZ's XML carries <iota>EU-048</iota> for an operator on an island, and OpsLog
read past it. Wired end to end: the provider, the lookup cache (a column, like
web and zip before it), and the entry's award references.

It matters more here than the same field would for another award. There is no
live "who is on an island right now" feed anywhere — POTA has one and that is
what OpsLog matches spots against; SOTA has one behind conditions; IOTA
publishes only static lists. So the callbook record is the practical source, and
it is known BEFORE the contact is logged, which is when a reference is useful.

The reference goes in as an IOTA award reference, exactly as one picked by hand,
so the existing path carries it to the qso.iota column on save.

Two limits, both deliberate. A reference the operator typed or picked WINS: a
callbook entry can be years out of date, and the operator in front of the radio
has just been told where the station is. And the value must look like an IOTA
reference — two letters, a hyphen, three digits — because writing anything else
into the award makes a reference no list contains, which counts for nothing and
has to be found by hand later.
2026-08-16 23:22:37 +02:00

45 lines
1.3 KiB
Go

package lookup
import (
"encoding/xml"
"strings"
"testing"
)
// QRZ sends the island reference and OpsLog read past it.
//
// It matters more for IOTA than it would for another award: unlike POTA there
// is no live "who is on an island right now" feed anywhere, so the callbook
// record is the practical source — and it is known BEFORE the contact is
// logged, which is when it is useful.
func TestQRZCallsignCarriesIOTA(t *testing.T) {
const body = `<?xml version="1.0" encoding="utf-8" ?>
<QRZDatabase version="1.34">
<Callsign>
<call>F5IRH</call>
<fname>Max</fname>
<country>France</country>
<grid>IN87ki</grid>
<cqzone>14</cqzone>
<iota>EU-048</iota>
</Callsign>
<Session><Key>abc</Key></Session>
</QRZDatabase>`
var resp qrzDB
if err := xml.Unmarshal([]byte(body), &resp); err != nil {
t.Fatalf("unmarshal: %v", err)
}
if resp.Callsign.IOTA != "EU-048" {
t.Fatalf("the <iota> tag decoded as %q — the field is not being read", resp.Callsign.IOTA)
}
// And a record with no island must not invent one.
var none qrzDB
if err := xml.Unmarshal([]byte(strings.Replace(body, "<iota>EU-048</iota>", "", 1)), &none); err != nil {
t.Fatalf("unmarshal: %v", err)
}
if none.Callsign.IOTA != "" {
t.Errorf("IOTA = %q for a record without one", none.Callsign.IOTA)
}
}