fix(search): make the "QSL Pending" filter actually filter - #238
Merged
Conversation
The search UI offers a QSL Status → Pending option, but the query builder only handled `confirmed` and `not_confirmed`. `pending` fell through the switch and added no predicate, so selecting it silently returned every contact instead of the ones awaiting a reply. Add a NULL-safe SENT_QSL_SQL expression (a QSL sent/requested/queued on paper, eQSL, LoTW, or QRZ per the ADIF Y/R/Q states) and wire `pending` to `SENT_QSL_SQL AND NOT CONFIRMED_QSL_SQL` — a strict subset of not_confirmed. Predicate-only, so it binds no parameter and keeps the placeholder numbering intact. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The contact search page exposes a QSL Status → Pending option in its Advanced Filters dropdown (
src/app/search/page.tsx), and the active-filter chip labels it "QSL Pending". But the shared query builder behindGET /api/contacts/search(src/lib/contact-search.ts) only handledconfirmedandnot_confirmed. Thependingvalue fell straight through theswitchand added no predicate.Result: selecting "Pending" was a silent no-op — the search returned every contact rather than the ones awaiting a QSL reply. The existing test even codified the wrong behavior (
'pending'"contributes nothing"), so the gap between UI and backend went unnoticed.Solution
SENT_QSL_SQLexpression: true when a QSL has been sent, requested, or queued on any channel — paper (qsl_sent), eQSL (eqsl_qsl_sent), LoTW (lotw_qsl_sent), or QRZ (qrz_qsl_sent) — per the ADIF QSL-status enumeration (Y/R/Q). It'sCOALESCE-wrapped to a never-NULL boolean, mirroring the existingCONFIRMED_QSL_SQL, so it composes cleanly.qslStatus = 'pending'to(SENT_QSL_SQL AND NOT CONFIRMED_QSL_SQL)— i.e. you've done your part but no source has confirmed yet. This is a strict subset ofnot_confirmed.$Nplaceholder numbering (the subject of fix(search): keep SQL placeholders aligned when QSL status + DXCC filters combine #236/fix(search): repair QSL-status filter that referenced a nonexistentconfirmedcolumn #237) stays intact when combined with value-bound filters like DXCC.No UI, schema, or API-shape changes — the frontend already sends
qslStatus=pending; it just now does something.Testing
tests/contact-search.spec.ts:pendingemits(SENT_QSL_SQL AND NOT CONFIRMED_QSL_SQL)with no bound param.SENT_QSL_SQLreferences only the real*_qsl_sentcolumns (never a received column or a bareconfirmed).pendingis now recognized.npx playwright test contact-search— 13 passed.npm run typecheck,npm run lint,npm run build— all clean.Follow-up (out of scope)
🤖 Generated with Claude Code