feat(matrix): the DIG row cycles through your own digital modes

One row per digital mode would be the honest layout, and there is no
height for it: the matrix sits in a fixed panel beside a dozen widgets.
So the row keeps its place and changes what it answers — DIG, then each
digital mode the operator's own list holds, in the order they put them
in, then back to DIG.

It costs no round trip. The query behind the matrix already grouped by
band AND mode; only the collapse to a class threw that away, so the same
cell is now published under the raw mode name too. Digital only: PH and
CW have nothing to cycle through.

On a specific mode the you-are-here mark follows THAT mode, or every FT4
entry would light whichever digital row the rotation happened to rest
on. A four-letter mode drops to 9px rather than widen a column sized for
three characters and push the whole matrix sideways. Opens 0.27.8.
This commit is contained in:
2026-09-01 23:47:03 +02:00
parent 6442325926
commit 74dfc3a725
6 changed files with 82 additions and 17 deletions
+24 -9
View File
@@ -2013,7 +2013,7 @@ type WorkedBefore struct {
// at all about yesterday.
type BandStatus struct {
Band string `json:"band"` // ADIF lowercase band, e.g. "20m"
Class string `json:"class"` // "PH" | "CW" | "DIG"
Class string `json:"class"` // "PH" | "CW" | "DIG", or a raw digital mode ("FT8", "RTTY"…)
Status string `json:"status"` // "call_c" | "call_w" | "dxcc_c" | "dxcc_w"
// Call is "", "w" (worked with this callsign) or "c" (confirmed with it).
Call string `json:"call,omitempty"`
@@ -2402,17 +2402,32 @@ func (r *Repo) WorkedBefore(ctx context.Context, callsign string, dxccHint int,
return wb, fmt.Errorf("scan band status: %w", err)
}
code := bandStatusCode(callW == 1, callC == 1, dxccConfirmed == 1)
k := cellKey{band: band, class: modeClass(mode)}
if cur, ok := best[k]; !ok || code > cur {
best[k] = code
keys := []cellKey{{band: band, class: modeClass(mode)}}
// The DIGITAL row can be cycled through the individual modes in the UI —
// FT8, then FT4, then RTTY — so the same cell is also published under the
// raw mode name. The query already grouped by mode; only the collapse to
// a class threw that away, and re-asking the database for it would be a
// second scan to learn what we had just read.
//
// Digital only: PH and CW have nothing to cycle through, and publishing
// "SSB" beside "PH" would just double the payload.
if um := strings.ToUpper(mode); modeClass(mode) == "DIG" && um != "" {
keys = append(keys, cellKey{band: band, class: um})
}
for _, k := range keys {
if cur, ok := best[k]; !ok || code > cur {
best[k] = code
}
}
// Confirmed beats worked here too, and neither is ever erased by the
// entity: this is only ever about the callsign.
switch {
case callC == 1:
callByCell[k] = "c"
case callW == 1 && callByCell[k] == "":
callByCell[k] = "w"
for _, k := range keys {
switch {
case callC == 1:
callByCell[k] = "c"
case callW == 1 && callByCell[k] == "":
callByCell[k] = "w"
}
}
}
statusRows.Close()