feat(decodes): NEW STATE — badge and filter

The WAS gap made visible: a worked-states set joins the cluster status cache
(distinct states over the three US entities), the status entries carry a
NewState flag wherever the state resolves (log county first, ULS licence
second), and the decode panel gains the badge in its status column plus the
filter chip alongside NEW/BAND/MODE/GRID. Colour from the shared marker
palette, so the cluster can adopt it later without a second hue.
This commit is contained in:
2026-08-30 20:44:58 +02:00
parent 81ff6a9b0e
commit 52e98a71f4
8 changed files with 61 additions and 12 deletions
+18 -3
View File
@@ -19819,9 +19819,12 @@ type SpotStatus struct {
// County and State are that resolved county, so the cluster can show it as a
// column instead of only flagging it. Free: the ULS lookup that decides
// NewCounty already has them in hand.
County string `json:"county,omitempty"`
State string `json:"state,omitempty"`
NewPOTA bool `json:"new_pota"`
County string `json:"county,omitempty"`
State string `json:"state,omitempty"`
// NewState says this US state has never been worked — the WAS gap the
// decode panel's filter chases. Orthogonal to Status, like NewCounty.
NewState bool `json:"new_state"`
NewPOTA bool `json:"new_pota"`
// Grid is the 4-character square this station announced in a CQ on the UDP
// link, and NewGrid says that square has never been worked. Both are empty /
// false for any station this receiver has not decoded — a DX-cluster line
@@ -19869,6 +19872,7 @@ type clusterStatusCache struct {
workedCallSlots map[string]struct{}
workedCallSlotsDig map[string]struct{} // same set, digital modes folded to DIG // nil unless the "same slot" option is on
workedCounties map[string]struct{}
workedStates map[string]struct{}
// callCounties holds callsign → "STATE,County" for stations already logged
// with a county, so a spot shows the county the entry panel showed rather
// than the one derived from the licence ZIP. See qso.CallCounties.
@@ -19967,6 +19971,7 @@ func (a *App) clusterStatusMaps() *clusterStatusCache {
// Orthogonal dimensions: worked US counties (for the ULS callsign→county
// lookup) and worked POTA parks.
c.workedCounties, _ = a.qso.WorkedCountyKeys(a.ctx, award.USCountyKey)
c.workedStates, _ = a.qso.WorkedStateKeys(a.ctx)
c.callCounties, _ = a.qso.CallCounties(a.ctx)
c.workedPOTA, _ = a.qso.WorkedPOTARefs(a.ctx)
// One more DISTINCT scan when the snapshot is rebuilt, then pure map lookups
@@ -20409,6 +20414,11 @@ func (a *App) ClusterSpotStatuses(spots []SpotQuery) []SpotStatus {
if cnty, ok := idx.callCounties[q.Call]; ok {
st, name, _ := strings.Cut(cnty, ",")
out[i].State, out[i].County = st, name
if st != "" {
if _, done := idx.workedStates[strings.ToUpper(st)]; !done {
out[i].NewState = true
}
}
// Logged means worked, so this can never be a new county — but say
// so through the same key the flag below uses, not by assumption.
if key := award.USCountyKey(st, name); key != "" {
@@ -20419,6 +20429,11 @@ func (a *App) ClusterSpotStatuses(spots []SpotQuery) []SpotStatus {
} else if a.uls != nil {
if loc, ok := a.uls.Resolve(q.Call); ok {
out[i].County, out[i].State = loc.County, loc.State
if loc.State != "" {
if _, done := idx.workedStates[strings.ToUpper(loc.State)]; !done {
out[i].NewState = true
}
}
if key := award.USCountyKey(loc.State, loc.County); key != "" {
if _, done := workedCounties[key]; !done {
out[i].NewCounty = true