Add QSO::completeWith() for merging duplicate QSO records
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:
- Configure Actions setup steps to set up my environment, which run before the firewall is enabled
- Add the appropriate URLs or hosts to the custom allowlist in this repository's Copilot coding agent settings (admins only)
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)
- Fixes ea4k/klog#854
💡 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.