feat(cluster): a SOTA column, and a spot click that credits the summit
The SOTA feeds put the summit in the spot's own text, so there is nothing to poll: a regex on the comment gives the reference, and clicking the spot writes SOTA@<ref> into the award references the way a park already wrote POTA@<ref>. The regex is narrow on purpose — association/region-NNN, anchored — because POTA (US-4475), WWFF (DLFF-0001) and portable callsigns (DL/SP9DPM/P) share that field and none of them is a summit. Pinned by a table test. Off by default: the reference is only there on the summit feeds, and an empty column for every operator who does not chase them is worse than a checkbox.
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
package cluster
|
||||
|
||||
import "regexp"
|
||||
|
||||
// sotaRefRe matches a SOTA summit reference inside a spot comment.
|
||||
//
|
||||
// The shape is association/region-NNN — "W9/WI-001", "DM/BM-063", "VK3/VC-014",
|
||||
// "F/AM-123" — and the association may carry digits. Anchored on both sides so
|
||||
// a callsign like DL/SP9DPM/P can never be read as one, and deliberately
|
||||
// narrower than "anything with a slash and a dash": POTA (US-4475) and WWFF
|
||||
// (DLFF-0001) refs share the comment field and must not be caught here.
|
||||
var sotaRefRe = regexp.MustCompile(`\b([A-Z0-9]{1,4}(?:/[A-Z0-9]{1,4})?/[A-Z]{2}-[0-9]{3})\b`)
|
||||
|
||||
// SOTARefFrom returns the first SOTA reference in a spot comment, or "".
|
||||
func SOTARefFrom(comment string) string {
|
||||
m := sotaRefRe.FindStringSubmatch(comment)
|
||||
if m == nil {
|
||||
return ""
|
||||
}
|
||||
return m[1]
|
||||
}
|
||||
Reference in New Issue
Block a user