Skip to content

Consolidate ADIF generation into a single serializer - #1046

Open
ea4k wants to merge 2 commits into
masterfrom
claude/pr-review-applicability-prwcz8
Open

Consolidate ADIF generation into a single serializer#1046
ea4k wants to merge 2 commits into
masterfrom
claude/pr-review-applicability-prwcz8

Conversation

@ea4k

@ea4k ea4k commented Jul 29, 2026

Copy link
Copy Markdown
Owner

Summary

Started as a follow-up to #1039 (guarding BAND_RX against empty/"0" values) and grew into a consolidation of how KLog produces ADIF, so the ADIF file is always written by the same function.

Changes

1. Club Log real-time upload — src/elog/elogclublog.cpp
The real-time uploader built BAND_RX by hand with a length() > 2 heuristic that was never updated with #1039. That heuristic drops empty/"0" but also drops legitimate 2‑character RX bands (6m, 4m, 2m). Replaced with the same guard used on the export path (non-empty, not "0", different from BAND).

2. Single ADIF serializer — src/qso.cpp, src/qso.h
QSO::getADIF() now always serializes through QSO::getADIFStandard(). The per-destination writers getADIFLoTW(), getADIFClubLog() and getADIFeQSL() were dead code:

  • nothing ever called getADIF() with ModeLotW/ModeEQSL, and there was no ModeClubLog branch;
  • the real LoTW/eQSL/Club Log file exports already went through getADIFStandard() and restricted the fields at the SQL SELECT level (FileManager::adifQSOsExport).

Removed the three unused functions and their declarations.

3. Centralized band validation — src/adif.cpp
Moved the "a band is never 0" rule into Adif::getADIFField() so BAND/BAND_RX placeholders are dropped in one single place for every caller, and restored the simpler same-as-BAND guard in getADIFStandard().

Scope / what is intentionally not in this PR

Two items from the same discussion are not included because they change untestable, outward-facing behavior and this repo can't be built in my environment (no Qt toolchain); I'd rather do them with a real build+test cycle:

  • Routing the Club Log real-time upload through QSO::getADIF. Today it assembles a 16‑field QStringList (getClubLogRealTimeFromId + getClubLogAdif). Unifying it would change the payload sent to Club Log's realtime endpoint, which I can't verify here.
  • Unifying the DB→QSO loaders (getADIFFromQSOQuery vs QSO::fromDB, flagged by an existing TODO). Large refactor across ~100 fields, only tangential to "the ADIF file is written by one function".

Testing

Not built locally (no Qt toolchain available). Static review only; relying on CI. Note the AppVeyor check was already red on #1039's head before these commits.

🤖 Generated with Claude Code

claude added 2 commits July 29, 2026 17:00
The ADIF export functions (getADIFStandard/getADIFLoTW/getADIFClubLog)
were fixed in PR #1039 to skip BAND_RX when the RX band is empty, "0",
or equal to BAND. The Club Log real-time upload built its BAND_RX field
independently with a `length() > 2` heuristic, which was not updated.

That heuristic happens to drop empty and "0" values, but it also drops
legitimate 2-character RX bands such as 6m, 4m and 2m. Replace it with
the same guard used on the export path: emit BAND_RX only when it is
non-empty, not "0", and different from BAND.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LMqkGaCivPaos391iJ9MeT
Follow-up refactor so the ADIF record is always produced by the same
function.

- QSO::getADIF() now always serializes through QSO::getADIFStandard().
  The per-destination writers getADIFLoTW(), getADIFClubLog() and
  getADIFeQSL() were dead code: nothing ever called getADIF() with
  ModeLotW/ModeEQSL and there was no ModeClubLog branch, while the actual
  LoTW/eQSL/Club Log file exports already went through getADIFStandard()
  and restricted the fields at the SQL SELECT level. Removed those three
  unused functions and their declarations.

- Moved the BAND/BAND_RX "0" rule into Adif::getADIFField() so it is
  enforced in a single place for every field that goes through it, and
  restored the simpler same-as-BAND guard in getADIFStandard().

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LMqkGaCivPaos391iJ9MeT
@ea4k ea4k changed the title Apply BAND_RX guard to Club Log real-time upload Consolidate ADIF generation into a single serializer Jul 29, 2026
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants