fix: keep the precise locator on digital QSOs; make the manual lookup real
Grid on the UDP path — WSJT-X and MSHV can only send a FOUR-character grid, that is all the FT8 protocol carries. The enrichment rule there is "fill only what is empty", so the coarse JN05 always won and QRZ's JN05JG was thrown away: roughly 100 km of accuracy discarded on every digital QSO. The lookup grid is now taken when it EXTENDS the received square. A lookup that disagrees outright (JN18 against JN05) is not a refinement — the station may be portable and what came over the air is then the better record. Both rules are pinned by tests. Manual fetch in the QSO editor — it read the CACHE, valid for 30 days. An operator who upgraded their QRZ subscription went on getting the thin free-account record and clearing the cached row by hand was the only way out. The button now forces a lookup that bypasses the cache, reaches the provider and REFRESHES the stored row, with a 15 s budget instead of 2 s: a deliberate click must reach the network, where giving up early would fall back to cty.dat and look like nothing happened. The automatic type-ahead lookup keeps the cache, which is where it earns its keep. Same fetch: it used `??`, which only guards against null. Go marshals an unset string as "", so a QRZ record with no grid BLANKED the grid already in the QSO. The lookup still wins — that is the point of asking for it — but an empty result no longer erases a good value.
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
package main
|
||||
|
||||
import "testing"
|
||||
|
||||
// The case that started this: WSJT-X / MSHV can only send a 4-character grid, so
|
||||
// a digital QSO arrived with JN05 while QRZ knew JN05JG — and the fill-if-empty
|
||||
// enrichment rule kept the coarse one. Roughly 100 km of accuracy, silently lost
|
||||
// on every digital QSO.
|
||||
func TestRefineGrid(t *testing.T) {
|
||||
cases := []struct{ have, found, want, why string }{
|
||||
{"JN05", "JN05JG", "JN05JG", "the lookup EXTENDS the received square — take the precise one"},
|
||||
{"jn05", "JN05JG", "JN05JG", "grids arrive in both cases"},
|
||||
{"", "JN05JG", "JN05JG", "nothing received — take whatever was found"},
|
||||
{"JN05JG", "", "JN05JG", "nothing found — keep what was received"},
|
||||
{"JN05JG", "JN05", "JN05JG", "never trade a precise grid for a coarse one"},
|
||||
{"JN05JG", "JN05JG", "JN05JG", "same grid"},
|
||||
// A DISAGREEMENT is not a refinement: the station may be portable, and
|
||||
// what came over the air is then the better record.
|
||||
{"JN05", "JN18AA", "JN05", "different square — keep what was actually received"},
|
||||
{"JN18AA", "JN05", "JN18AA", "different square, coarse lookup — keep the received one"},
|
||||
{"", "", "", "nothing either way"},
|
||||
}
|
||||
for _, c := range cases {
|
||||
if got := refineGrid(c.have, c.found); got != c.want {
|
||||
t.Errorf("refineGrid(%q, %q) = %q, want %q — %s", c.have, c.found, got, c.want, c.why)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user