fix(awards): WAJA was numbered by the Japanese state, not by the JARL
The catalog carried Japan's civil prefecture code (JIS X 0401) — 01 Hokkaido, 02 Aomori, 03 Iwate, 04 Miyagi — where the award uses the JARL's own numbering. The two agree on the first three prefectures and then part company on 35 of the remaining 44: Tokyo is 10 to the JARL and 13 to the government, Niigata 08 against 15, Toyama 28 against 16. The names were right throughout, which is why nothing looked wrong: the award matches on the prefecture NAME in the QTH, so it counted exactly the right contacts. Only the number against each one was wrong — and that number is what an operator writes on a JARL claim. Renumbered by name from the official JARL list, so everything else each entry carried travels with it. That includes the Tokyo spelling pattern, which had to move from 13 to 10; left where it was it would have been matching QTHs for Saitama. Two digits throughout, as the JARL prints them. Not cosmetic: the codes are strings, so "1" sorts between "09" and "10" and the reference list appeared in an order no published list uses. Version 2 on the definition, so this actually reaches people. An operator who has not edited WAJA gets it at startup; one who has is offered it, since their work outranks ours. Nobody has to re-import by hand. Reported with the official JARL chart alongside the exported award.
This commit is contained in:
@@ -0,0 +1,101 @@
|
||||
package award
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"testing"
|
||||
)
|
||||
|
||||
// WAJA is numbered by the JARL, and the numbering is NOT Japan's ordinary
|
||||
// prefecture code.
|
||||
//
|
||||
// The catalog shipped with the government's JIS numbering instead — 01
|
||||
// Hokkaido, 02 Aomori, 03 Iwate, 04 Miyagi… — which agrees with the JARL's for
|
||||
// the first three prefectures and then diverges for thirty-five of the
|
||||
// remaining forty-four. The names were right throughout, so the award still
|
||||
// counted the right contacts; every reference simply carried the wrong number,
|
||||
// which is what an operator sends to the JARL when they claim it.
|
||||
//
|
||||
// The two schemes agree often enough to look correct at a glance, so this pins
|
||||
// the places they differ rather than a count. Each pair below is one the old
|
||||
// list got wrong, and the comment is what the old list said.
|
||||
func TestCatalogWAJAUsesTheJARLNumbering(t *testing.T) {
|
||||
raw, ok := CatalogRefs("WAJA")
|
||||
if !ok {
|
||||
t.Fatal("WAJA has no reference list in the embedded catalog")
|
||||
}
|
||||
var refs []struct {
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
Pattern string `json:"pattern"`
|
||||
}
|
||||
if err := json.Unmarshal(raw, &refs); err != nil {
|
||||
t.Fatalf("WAJA references: %v", err)
|
||||
}
|
||||
if len(refs) != 47 {
|
||||
t.Fatalf("WAJA has %d prefectures, want exactly 47", len(refs))
|
||||
}
|
||||
|
||||
byName := map[string]string{}
|
||||
byCode := map[string]string{}
|
||||
for _, r := range refs {
|
||||
byName[r.Name] = r.Code
|
||||
if prev, dup := byCode[r.Code]; dup {
|
||||
t.Errorf("number %s is on both %s and %s", r.Code, prev, r.Name)
|
||||
}
|
||||
byCode[r.Code] = r.Name
|
||||
}
|
||||
|
||||
for _, c := range []struct{ name, code string }{
|
||||
{"Hokkaido", "01"}, // the one both schemes agree on, and the anchor
|
||||
{"Miyagi", "06"}, // was 04
|
||||
{"Akita", "04"}, // was 05
|
||||
{"Niigata", "08"}, // was 15 — the JIS number
|
||||
{"Nagano", "09"}, // was 20
|
||||
{"Tokyo", "10"}, // was 13, the JIS number everyone recognises
|
||||
{"Kanagawa", "11"}, // was 14
|
||||
{"Saitama", "13"}, // was 11
|
||||
{"Ibaraki", "14"}, // was 8
|
||||
{"Gunma", "16"}, // was 10
|
||||
{"Yamanashi", "17"}, // was 19
|
||||
{"Kyoto", "22"}, // was 26
|
||||
{"Osaka", "25"}, // was 27
|
||||
{"Toyama", "28"}, // was 16
|
||||
{"Ishikawa", "30"}, // was 17
|
||||
{"Okayama", "31"}, // was 33
|
||||
{"Tottori", "34"}, // was 31
|
||||
{"Kagawa", "36"}, // was 37
|
||||
{"Tokushima", "37"}, // was 36
|
||||
{"Okinawa", "47"}, // unchanged: the far end of the list was already right
|
||||
} {
|
||||
if got := byName[c.name]; got != c.code {
|
||||
t.Errorf("%s is numbered %q, want %q on the JARL list", c.name, got, c.code)
|
||||
}
|
||||
}
|
||||
|
||||
// Two digits throughout, as the JARL prints them. Not cosmetic: the codes
|
||||
// are strings, so "1" sorts between "09" and "10" and the panel showed the
|
||||
// prefectures in an order no list anywhere uses.
|
||||
for _, r := range refs {
|
||||
if len(r.Code) != 2 {
|
||||
t.Errorf("%s is numbered %q — the JARL list is two digits throughout", r.Name, r.Code)
|
||||
}
|
||||
}
|
||||
|
||||
// The Tokyo spelling rule has to sit on Tokyo, and Tokyo moved. Left behind
|
||||
// on the old number it would be matching QTHs for Saitama.
|
||||
for _, r := range refs {
|
||||
if r.Pattern == "" {
|
||||
continue
|
||||
}
|
||||
if r.Name != "Tokyo" {
|
||||
t.Errorf("%s (%s) carries the pattern %q, which belongs to Tokyo", r.Name, r.Code, r.Pattern)
|
||||
}
|
||||
}
|
||||
if byName["Tokyo"] != "" {
|
||||
for _, r := range refs {
|
||||
if r.Name == "Tokyo" && r.Pattern == "" {
|
||||
t.Error("Tokyo lost its spelling pattern in the renumbering — Tokio would stop counting")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user