Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 25, 2025

Implements QSO::completeWith(const QSO& q2) to fill empty fields from another QSO without overwriting existing values. Enables merging duplicate QSO records during import and LoTW synchronization.

Changes

Core Implementation

  • Added bool completeWith(const QSO& q2) to QSO class
  • Checks all ~120 ADIF fields against their empty values (empty strings, -1 for ints, invalid dates, etc.)
  • Fills only empty fields from q2, preserving all existing values in calling QSO

Frequency Handling

  • Creates temporary copies to call non-const Frequency::isValid() on const references
  • Uses direct assignment (consistent with copy() method) since setters accept doubles, not Frequency objects

Test Coverage

  • Four test cases: basic completion, empty QSO fill, numeric fields, date fields
  • Updated test CMakeLists.txt with missing qsodatacache.cpp dependency

Incidental Fixes

  • Fixed syntax errors in database.cpp (lines 83, 1653) preventing compilation

Example Usage

QSO qso1, qso2;

// qso1 has partial data
qso1.setCall("EA4K");
qso1.setBand("20M");
qso1.setRSTTX("59");

// qso2 has overlapping and additional data
qso2.setCall("EA4K");       // Same
qso2.setBand("40M");        // Different - will NOT overwrite
qso2.setRSTRX("58");        // Missing in qso1 - will fill
qso2.setGridSquare("IN80"); // Missing in qso1 - will fill

qso1.completeWith(qso2);

// Result: qso1.getBand() == "20M" (preserved)
//         qso1.getRSTRX() == "58" (filled)
//         qso1.getGridSquare() == "IN80" (filled)

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • esm.ubuntu.com
    • Triggering command: /usr/lib/apt/methods/https /usr/lib/apt/methods/https (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Create QSO::completeWith(const QSO & q2)</issue_title>
<issue_description>The qso should read all the values of the argument q2 and complete if the calling qso has empty values.
If the calling qso has a value in a variable and q2 too, q2 value is never overwriting the value of the calling qso.

Note: This will be valuable for import and lotw ... when a qso is duplicated</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 4 commits December 25, 2025 20:58
Co-authored-by: ea4k <29511627+ea4k@users.noreply.github.com>
- Fixed const-correctness issue with Frequency::isValid()
- Fixed pre-existing syntax errors in database.cpp
- Added qsodatacache.cpp to test CMakeLists.txt
- Code compiles successfully

Co-authored-by: ea4k <29511627+ea4k@users.noreply.github.com>
- Clarified why temporary copies are needed for Frequency objects
- Explained why direct assignment is used instead of setters
- Code compiles successfully and is ready for review

Co-authored-by: ea4k <29511627+ea4k@users.noreply.github.com>
Co-authored-by: ea4k <29511627+ea4k@users.noreply.github.com>
Copilot AI changed the title [WIP] Add QSO::completeWith method for merging values Add QSO::completeWith() for merging duplicate QSO records Dec 25, 2025
Copilot AI requested a review from ea4k December 25, 2025 21:10
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.

Create QSO::completeWith(const QSO & q2)

2 participants