feat(logging): persist per-QSO transmit power (tx_pwr) end to end#244
Merged
Merged
Conversation
The "Power (W)" field on the log form was collected and POSTed as `power`, but no column consumed it and `Contact.create` never inserted it — so an operator's per-QSO power was silently dropped on save, and ADIF export could only emit the station's single default power. - schema: add nullable `contacts.tx_pwr numeric(10,2)` (ADIF TX_PWR, watts) + migration 0006_add_contacts_tx_pwr. - Contact.create: persist tx_pwr. - new-contact form: send the ADIF-standard `tx_pwr` at the wire (component state stays `power`, which is form-local and exempt from snake_case). - ADIF import: read TX_PWR so imported logs keep per-QSO power. - ADIF export: COALESCE(c.tx_pwr, s.power_watts) so a per-QSO value wins and falls back to the station default; the search export's SELECT * carries it automatically. - EditContactDialog: expose Power (W) so a logged/imported value is visible and editable (blank clears to NULL, not an empty string). - tests: guard tx_pwr export + parser round-trip in adif-generate.spec. 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 Power (W) field on the Log a contact form is collected and POSTed, but the value was silently discarded:
contactshad no power column, andContact.createnever inserted it.power, which no route or model consumed.stations.power_watts), never the actual power a QSO was made with, and ADIF import ignoredTX_PWRentirely.Net effect: an operator dutifully records power for each QSO and it vanishes on save — a visible form field that does nothing, plus a round-trip data loss on import/export.
Solution
Wire transmit power through as a genuine per-QSO field, using the ADIF-standard name
tx_pwr(watts):contacts.tx_pwr numeric(10,2)(drizzle/schema.ts+ generated0006_add_contacts_tx_pwr.sql). Backwards compatible: existing rows areNULL.Contact.createnow insertstx_pwr; the log form sends the snake_casetx_pwrat thefetch()call site (component-local state stayspower, which is form-internal and exempt from the snake_case rule).TX_PWRso logs imported from other software keep each contact's power.COALESCE(c.tx_pwr, s.power_watts)so a per-QSO value wins and falls back to the station default; the search-results export (SELECT *) carries the column automatically.generateAdifalready emittedtx_pwr, so nothing else changed there.NULLrather than an empty string a numeric column would reject.Testing
npm run typecheck— cleannpm run lint— cleannpm run build— compiled successfullynpx playwright teston the DB-free pure-function specs (84 tests) — all pass, including newadif-generatecases that guardtx_pwrexport, a fractional QRP value, omission when absent, and a parser round-trip.ALTER TABLE contacts ADD COLUMN tx_pwr numeric(10, 2);, generated bydrizzle-kit generateand applied through the runtime migrator (/api/admin/migrate,/install) like the existing migrations. DB-integration/browser specs require a live Postgres + server and were not run in this environment.Follow-up (out of scope)
QuickLogCardquick-logger has no power input; adding one there is a natural next step.🤖 Generated with Claude Code