feat(cluster): "already worked only on the same slot" option

New DX Cluster setting (Settings → DX Cluster). Off (today's behaviour) a call
worked anywhere reads as already worked; on, the WORKED-call flag needs the same
band AND mode. It folds through the digital-mode grouping (Settings → General):
grouped, a 20m FT8 contact also marks a 20m FT4 spot worked; ungrouped they are
separate slots. Backend: qso.WorkedCallSlotKeys builds CALL|band and
CALL|band|mode(grouped) keys; ClusterSpotStatuses uses them when the option is on
(a spot with no inferable mode falls back to same-band).
This commit is contained in:
2026-08-05 14:11:06 +02:00
parent f91b83ee12
commit d0f25aea9b
5 changed files with 80 additions and 3 deletions
+36 -1
View File
@@ -2400,6 +2400,19 @@ func (a *App) groupDigitalSlots() bool {
return v == "1"
}
// clusterWorkedSameSlot reports the "consider a call already worked only if
// worked on the SAME band+mode slot" cluster preference (Settings → DX Cluster).
// Off (default) → a call worked on any band/mode reads as already worked. On →
// the WORKED-call flag needs the same band and mode (digital-grouped when that
// option is also on).
func (a *App) clusterWorkedSameSlot() bool {
if a.settings == nil {
return false
}
v, _ := a.settings.Get(a.ctx, "ui.opslog.clusterWorkedSameSlot")
return v == "1"
}
func (a *App) GetUIPref(key string) (string, error) {
if a.settings == nil || !a.settingsScoped.Load() {
// Distinct from a genuinely-empty pref: the (LOCAL SQLite) settings store
@@ -15925,6 +15938,14 @@ func (a *App) ClusterSpotStatuses(spots []SpotQuery) []SpotStatus {
// "I've already QSO'd this exact station" even when the band/mode
// makes the entity check say "new-band" or "new-slot".
workedCalls, _ := a.qso.WorkedCallsigns(a.ctx)
// "Already worked only on the same slot" option (Settings → DX Cluster): the
// WORKED-call flag then needs the SAME band and mode (digital-grouped through
// the same normMode when that option is on) rather than the call anywhere.
sameSlot := a.clusterWorkedSameSlot()
var workedCallSlots map[string]struct{}
if sameSlot {
workedCallSlots, _ = a.qso.WorkedCallSlotKeys(a.ctx, normMode)
}
// Orthogonal dimensions: worked US counties (for the ULS callsign→county
// lookup) and worked POTA parks. Both built once per batch.
workedCounties, _ := a.qso.WorkedCountyKeys(a.ctx, award.USCountyKey)
@@ -15945,7 +15966,21 @@ func (a *App) ClusterSpotStatuses(spots []SpotQuery) []SpotStatus {
Band: strings.ToLower(q.Band),
Mode: strings.ToUpper(q.Mode),
}
if _, ok := workedCalls[strings.ToUpper(q.Call)]; ok {
if sameSlot {
// Already worked ONLY when this exact band+mode slot was worked. With no
// inferable mode, fall back to same-band (better than claiming the whole
// call is fresh). Digital grouping folds through the same normMode.
upCall := strings.ToUpper(q.Call)
if out[i].Mode == "" {
_, out[i].WorkedCall = workedCallSlots[upCall+"|"+out[i].Band]
} else {
cm := out[i].Mode
if normMode != nil {
cm = normMode(cm)
}
_, out[i].WorkedCall = workedCallSlots[upCall+"|"+out[i].Band+"|"+cm]
}
} else if _, ok := workedCalls[strings.ToUpper(q.Call)]; ok {
out[i].WorkedCall = true
}
// NEW PFX: the spot's CQ WPX prefix, never worked before.