fix(confirmations): count a LoTW "V" everywhere, not only in the awards

An operator's screenshot had it side by side: the Awards panel showed Morocco
validated on five bands, and the band/mode matrix two inches above showed the
entity as merely worked.

ADIF's QSL_Rcvd enumeration has both Y and V — "received" and "verified" — and
V is what a LoTW download writes for a confirmation the ARRL has validated. The
award engine's isYes accepted "Y" or "V". Everything else in the app compared
against 'Y' alone: the worked-before status grid, the slot statistics, the row
colouring by QSL status, the awards QSO list, the call history badges. So the
confirmations an operator cares most about were the ones that did not count.

Now one definition per side, named so the next reader finds the other:
qso.ConfirmedValues on the Go side, used by the queries themselves, and
isQSLConfirmed in lib/qsl on the frontend, which rowColors and the panels call
instead of testing the letter.

The Go test drives the real query shape against a real database with a 'V' row
— the constant being right is not the point, the queries using it is.
This commit is contained in:
2026-08-15 08:31:49 +02:00
parent ca8617c891
commit 09f3ddaacb
9 changed files with 119 additions and 12 deletions
+2 -1
View File
@@ -7,6 +7,7 @@ import { Button } from '@/components/ui/button';
import { Checkbox } from '@/components/ui/checkbox';
import { Select, SelectTrigger, SelectValue, SelectContent, SelectItem } from '@/components/ui/select';
import { cn } from '@/lib/utils';
import { isQSLConfirmed } from '@/lib/qsl';
import { AwardEditor } from '@/components/AwardEditor';
import { useI18n } from '@/lib/i18n';
import { writeUiPref } from '@/lib/uiPref';
@@ -818,7 +819,7 @@ function CellQSOModal({ code, cell, modeClass, onClose }: { code: string; cell:
<td className="py-1 pr-2 font-mono font-semibold">{q.callsign}</td>
<td className="py-1 pr-2">{q.band}</td>
<td className="py-1 pr-2">{q.mode}</td>
<td className="py-1 pr-3 text-muted-foreground">{[q.lotw_rcvd === 'Y' && 'LoTW', q.qsl_rcvd === 'Y' && 'QSL', q.eqsl_rcvd === 'Y' && 'eQSL'].filter(Boolean).join(', ')}</td>
<td className="py-1 pr-3 text-muted-foreground">{[isQSLConfirmed(q.lotw_rcvd) && 'LoTW', isQSLConfirmed(q.qsl_rcvd) && 'QSL', isQSLConfirmed(q.eqsl_rcvd) && 'eQSL'].filter(Boolean).join(', ')}</td>
</tr>
))}
</tbody>
+2 -1
View File
@@ -3,6 +3,7 @@ import { Star, Radio, Sunrise, Sunset, X, Loader2 } from 'lucide-react';
import { Badge } from '@/components/ui/badge';
import { cn } from '@/lib/utils';
import { sunTimes } from '@/lib/sun';
import { isQSLConfirmed } from '@/lib/qsl';
import { BandSlotQSOs } from '../../wailsjs/go/main/App';
import type { WorkedBeforeView } from '@/types';
@@ -426,7 +427,7 @@ function SlotQSOModal({ call, dxcc, entity, band, cls, onClose, onEdit }: {
</thead>
<tbody>
{rows.map((q, i) => {
const cfm = q.lotw_rcvd === 'Y' || q.eqsl_rcvd === 'Y' || q.qsl_rcvd === 'Y';
const cfm = isQSLConfirmed(q.lotw_rcvd) || isQSLConfirmed(q.eqsl_rcvd) || isQSLConfirmed(q.qsl_rcvd);
const mine = q.callsign === call;
return (
<tr key={q.id ?? i} className="border-t border-border/40 even:bg-muted/[0.06] hover:bg-primary/[0.06] transition-colors">
+3 -2
View File
@@ -1,6 +1,7 @@
import { Star } from 'lucide-react';
import { Badge } from '@/components/ui/badge';
import { useI18n } from '@/lib/i18n';
import { isQSLConfirmed } from '@/lib/qsl';
import type { WorkedBeforeView } from '@/types';
type WorkedBefore = WorkedBeforeView;
@@ -97,10 +98,10 @@ export function CallHistoryPanel({ wb, busy, currentCall }: Props) {
<td className="px-2 py-1 font-mono border-b border-border/40 whitespace-nowrap">{e.rst_sent ?? ''}</td>
<td className="px-2 py-1 font-mono border-b border-border/40 whitespace-nowrap">{e.rst_rcvd ?? ''}</td>
<td className="px-2 py-1 border-b border-border/40 whitespace-nowrap text-muted-foreground">
{e.lotw_rcvd === 'Y' && (
{isQSLConfirmed(e.lotw_rcvd) && (
<span className="inline-block w-[14px] h-[14px] rounded text-center leading-[14px] text-[9px] font-bold text-info-foreground bg-info mr-0.5" title={t('chp.lotwRcvd')}>L</span>
)}
{e.qsl_rcvd === 'Y' && (
{isQSLConfirmed(e.qsl_rcvd) && (
<span className="inline-block w-[14px] h-[14px] rounded text-center leading-[14px] text-[9px] font-bold text-success-foreground bg-success mr-0.5" title={t('chp.bureauRcvd')}>B</span>
)}
</td>
+17
View File
@@ -0,0 +1,17 @@
// One answer to "is this QSL received".
//
// ADIF's QSL_Rcvd enumeration has BOTH Y and V: Y is "received", V is
// "verified" — and V is what a LoTW download writes for a confirmation the ARRL
// has validated. Testing for 'Y' alone therefore misses exactly the
// confirmations an operator cares most about.
//
// It showed on screen: the Awards panel had Morocco validated on five bands
// while the band/mode matrix beside it showed the entity as merely worked. The
// award engine accepted Y or V; every other test in the app accepted Y.
//
// The Go side has the same rule twice over — award.isYes and qso.ConfirmedValues
// — and all three have to agree. If you add a value here, add it there.
export function isQSLConfirmed(v: unknown): boolean {
const s = String(v ?? '').trim().toUpperCase();
return s === 'Y' || s === 'V';
}
+4 -1
View File
@@ -1,3 +1,4 @@
import { isQSLConfirmed } from '@/lib/qsl';
// Row colouring for the log grid, by QSL status.
//
// Four categories, each scoped to the channels the operator cares about —
@@ -32,7 +33,9 @@ const FIELDS: Record<string, { sent: string; rcvd: string }> = {
// ADIF QSL fields are single letters. Y is the only one that means "yes";
// R (requested) and Q (queued) mean it has not gone out yet — a different state,
// and the one an operator looks for when deciding what to send.
const yes = (v: any) => String(v ?? '').trim().toUpperCase() === 'Y';
// Y or V — see lib/qsl. A LoTW-verified contact is confirmed, and colouring it
// as unconfirmed is the same bug the band/mode matrix had.
const yes = (v: any) => isQSLConfirmed(v);
const owed = (v: any) => {
const s = String(v ?? '').trim().toUpperCase();
return s === 'R' || s === 'Q';