feat: added Worked All Italian Provinces award and FFMA
This commit is contained in:
+27
-11
@@ -693,7 +693,15 @@ func candidates(d *Def, re *regexp.Regexp, q *qso.QSO, rl refList, hasList bool)
|
||||
// only while nothing has matched yet, and stop at the first that yields a
|
||||
// reference (short-circuit). So a province already found by NAME isn't also
|
||||
// re-derived, possibly differently, from a later city-regex rule.
|
||||
found := searchOne(d.Field, d.MatchBy, re, d.ExactMatch, d.LeadingStr, d.TrailingStr, "", q, rl, predefined)
|
||||
//
|
||||
// The short-circuit tests what a rule REALLY yielded — the references that
|
||||
// survive the predefined list — not its raw candidates. A rule can always
|
||||
// produce a raw candidate and still find nothing: "the whole ADDRESS field is
|
||||
// the code" hands back "SERIATE (BG) 24068 ITALY", which is not a province.
|
||||
// Testing the raw candidate would call that a hit, skip every fallback, and
|
||||
// only then drop it as unlisted — leaving the QSO unmatched even though the
|
||||
// next rule ("find the code inside the QTH") would have found BG.
|
||||
found := keepRefs(predefined, rl, searchOne(d.Field, d.MatchBy, re, d.ExactMatch, d.LeadingStr, d.TrailingStr, "", q, rl, predefined))
|
||||
for i := 0; len(found) == 0 && i < len(d.OrRules); i++ {
|
||||
r := &d.OrRules[i]
|
||||
var rre *regexp.Regexp
|
||||
@@ -704,7 +712,7 @@ func candidates(d *Def, re *regexp.Regexp, q *qso.QSO, rl refList, hasList bool)
|
||||
}
|
||||
rre = c
|
||||
}
|
||||
found = searchOne(r.Field, r.MatchBy, rre, r.ExactMatch, r.LeadingStr, r.TrailingStr, r.Prefix, q, rl, predefined)
|
||||
found = keepRefs(predefined, rl, searchOne(r.Field, r.MatchBy, rre, r.ExactMatch, r.LeadingStr, r.TrailingStr, r.Prefix, q, rl, predefined))
|
||||
}
|
||||
|
||||
// Merge operator-assigned references (manual override, ManualRefsKey). Lets
|
||||
@@ -714,18 +722,26 @@ func candidates(d *Def, re *regexp.Regexp, q *qso.QSO, rl refList, hasList bool)
|
||||
// hand. Applied HERE (not just in MatchQSO) so Compute — which powers the
|
||||
// awards panel and the per-QSO refs editor — honours overrides too. For a
|
||||
// predefined award the ref is still validated against the list below.
|
||||
for _, c := range manualRefs(q, d.Code) {
|
||||
found = append(found, normalizeRef(c))
|
||||
}
|
||||
found = append(found, keepRefs(predefined, rl, manualRefs(q, d.Code))...)
|
||||
return dedupe(found)
|
||||
}
|
||||
|
||||
// keepRefs reduces a rule's raw candidates to the references that actually count.
|
||||
// For a predefined award that means the codes on the list, enabled. The
|
||||
// award-level DXCCFilter already scopes which QSOs are considered (see inScope),
|
||||
// so we do NOT additionally require the QSO's entity to match the reference's own
|
||||
// DXCC — that wrongly excluded e.g. WAS Alaska (state AK is DXCC entity 6, not
|
||||
// 291). Per-reference DXCC stays metadata for the picker.
|
||||
func keepRefs(predefined bool, rl refList, found []string) []string {
|
||||
if !predefined {
|
||||
return dedupe(found)
|
||||
out := make([]string, 0, len(found))
|
||||
for _, c := range found {
|
||||
if c = normalizeRef(c); c != "" {
|
||||
out = append(out, c)
|
||||
}
|
||||
}
|
||||
return dedupe(out)
|
||||
}
|
||||
// Enforce the predefined list: keep only listed, valid references. The
|
||||
// award-level DXCCFilter already scopes which QSOs are considered (see
|
||||
// inScope), so we do NOT additionally require the QSO's entity to match the
|
||||
// reference's own DXCC — that wrongly excluded e.g. WAS Alaska (state AK is
|
||||
// DXCC entity 6, not 291). Per-reference DXCC stays metadata for the picker.
|
||||
var out []string
|
||||
seen := map[string]struct{}{}
|
||||
for _, c := range found {
|
||||
|
||||
Reference in New Issue
Block a user