diff --git a/internal/qso/qso.go b/internal/qso/qso.go index 349f9a4..221f010 100644 --- a/internal/qso/qso.go +++ b/internal/qso/qso.go @@ -2236,13 +2236,17 @@ func (r *Repo) WorkedBefore(ctx context.Context, callsign string, dxccHint int, // The grid answers "what do I still need on this band and mode", and for // that question confirmation is the axis that matters: a confirmed entity // needs nothing, whoever else was worked afterwards. + // The two per-callsign columns use the SAME predicate as the callsign count + // above, portable variants included: a cell that counts RI1FJL/1 in "worked + // with this call" and a header that does not would be two answers to one + // question. // Filter NULL/empty band+mode rows — they'd create a NULL group key // that Scan into *string can't handle and would error out the whole // WorkedBefore call, blanking the matrix in the UI. statusRows, err := r.db.QueryContext(ctx, ` SELECT band, mode, - MAX(CASE WHEN callsign = ? THEN 1 ELSE 0 END), - MAX(CASE WHEN callsign = ? + MAX(CASE WHEN `+pred+` THEN 1 ELSE 0 END), + MAX(CASE WHEN `+pred+` AND (lotw_rcvd IN `+ConfirmedValues+` OR qsl_rcvd IN `+ConfirmedValues+` OR eqsl_rcvd IN `+ConfirmedValues+`) THEN 1 ELSE 0 END), MAX(CASE WHEN lotw_rcvd IN `+ConfirmedValues+` OR qsl_rcvd IN `+ConfirmedValues+` OR eqsl_rcvd IN `+ConfirmedValues+` @@ -2251,7 +2255,7 @@ func (r *Repo) WorkedBefore(ctx context.Context, callsign string, dxccHint int, WHERE dxcc = ? AND band IS NOT NULL AND band != '' AND mode IS NOT NULL AND mode != '' - GROUP BY band, mode`, wb.Callsign, wb.Callsign, dxcc) + GROUP BY band, mode`, append(append(append([]any{}, predArgs...), predArgs...), dxcc)...) if err != nil { return wb, fmt.Errorf("band status: %w", err) }