fix: a hand-assigned award reference no longer loses to the matcher
Reported on the DARC DOK award, with DL2FDM: a German address matches two or three DOKs, the operator deletes the wrong ones and assigns the right one, and the next recompute puts the wrong ones straight back. The manual reference was APPENDED to what the matcher found. Storage already kept exactly one manual entry per award — setOverrideRef drops the previous one — so it was an override everywhere except at the one place it mattered. The operator was arguing with the matcher and could not win. It now replaces. The trace records what was superseded, so a corrected QSO can still be explained rather than being merely different. A QSO with no correction keeps every automatic reference, which the test also pins: an override must not quietly disable matching for everyone else. This does not address the over-matching itself — an address containing "Berlin Mitte, 10115 Berlin" genuinely matches two DOK descriptions. That is the next question, and a separate one.
This commit is contained in:
+21
-2
@@ -859,7 +859,11 @@ type Explanation struct {
|
||||
RefCount int `json:"ref_count"` // size of that list
|
||||
Steps []Step `json:"steps"`
|
||||
Manual []string `json:"manual,omitempty"` // references the operator assigned by hand
|
||||
Result []string `json:"result"` // what the QSO finally counts for
|
||||
// Superseded is what the matcher had found before the operator's choice
|
||||
// replaced it — shown in the trace so a correction is explainable rather
|
||||
// than mysterious.
|
||||
Superseded []string `json:"superseded,omitempty"`
|
||||
Result []string `json:"result"` // what the QSO finally counts for
|
||||
}
|
||||
|
||||
// Explain runs the matcher on a single QSO and reports what it did. It goes
|
||||
@@ -977,7 +981,22 @@ func candidatesTrace(d *Def, re *regexp.Regexp, q *qso.QSO, rl refList, hasList
|
||||
if ex != nil {
|
||||
ex.Manual = manual
|
||||
}
|
||||
found = append(found, manual...)
|
||||
// An operator's choice REPLACES what the matcher found. It does not join it.
|
||||
//
|
||||
// Adding to it was the behaviour, and it made a correction impossible: a
|
||||
// German address matching two or three DOKs kept them all, so deleting the
|
||||
// wrong ones and assigning the right one lasted exactly until the next
|
||||
// recompute, which put them straight back. The operator was arguing with
|
||||
// the matcher and could not win.
|
||||
//
|
||||
// One manual entry is stored per award (setOverrideRef drops the previous
|
||||
// one), so this is an override in the storage as well as in the name.
|
||||
if len(manual) > 0 {
|
||||
if ex != nil {
|
||||
ex.Superseded = dedupe(found)
|
||||
}
|
||||
found = manual
|
||||
}
|
||||
out := dedupe(found)
|
||||
if ex != nil {
|
||||
ex.Result = out
|
||||
|
||||
Reference in New Issue
Block a user