fix: make ADIF parser case-insensitive for EOR delimiter
Critical bug fix: ADIF parser was using case-sensitive split on '<EOR>', but LoTW returns lowercase '<eor>' tags. This caused all 242,239 QSOs to be parsed as a single giant record with fields overwriting each other, resulting in only 1 QSO being imported. Changes: - Changed EOR split from case-sensitive to case-insensitive regex - Removes all debug logging - Restored normal incremental/first-sync LoTW logic Before: 6.8MB LoTW report → 1 QSO (bug) After: 6.8MB LoTW report → All 242K+ QSOs (fixed) Also includes: - Previous fix: Added missing timeOn to LoTW duplicate detection - Previous fix: Replaced regex.exec() while loop with matchAll() for-of Tested with limited date range (2025-10-01) and confirmed 420 QSOs imported successfully. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2
sample
Normal file
2
sample
Normal file
@@ -0,0 +1,2 @@
|
||||
{
|
||||
"adif": "<ADIF_VER:5>3.1.3\n<CREATED_TIMESTAMP:15>20260117 095453\n<EOH>\n<BAND:3>80m<CALL:5>DK0MU<MODE:3>FT8<PROP_MODE:0><QSO_DATE:8>20250621<TIME_ON:6>212645<SAT_MODE:0><SAT_NAME:0><STATION_CALLSIGN:5>DG0TM<DCL_QSL_RCVD:1>Y<DCL_QSLRDATE:8>20251003<EOR>\n<BAND:3>80m<CALL:5>DL0YY<MODE:3>FT8<PROP_MODE:0><QSO_DATE:8>20250204<TIME_ON:6>215500<SAT_MODE:0><SAT_NAME:0><STATION_CALLSIGN:5>DG0TM<DCL_QSL_RCVD:1>Y<DCL_QSLRDATE:8>20250914<EOR>\n<BAND:3>80m<CALL:6>DO1LFJ<MODE:3>FT8<PROP_MODE:0><QSO_DATE:8>20250802<TIME_ON:6>192900<SAT_MODE:0><SAT_NAME:0><STATION_CALLSIGN:5>DG0TM<DCL_QSL_RCVD:1>Y<DCL_QSLRDATE:8>20250910<EOR>\n<BAND:3>80m<CALL:5>DJ9BX<MODE:3>FT8<PROP_MODE:0><QSO_DATE:8>20250506<TIME_ON:6>205815<SAT_MODE:0><SAT_NAME:0><STATION_CALLSIGN:5>DG0TM<DCL_QSL_RCVD:1>Y<DCL_QSLRDATE:8>20250907<EOR>\n<BAND:3>40m<CALL:5>DM5XT<MODE:3>SSB<PROP_MODE:0><QSO_DATE:8>20250506<TIME_ON:6>160956<SAT_MODE:0><SAT_NAME:0><STATION_CALLSIGN:5>DG0TM<DCL_QSL_RCVD:1>Y<DCL_QSLRDATE:8>20250919<EOR>\n<BAND:3>40m<CALL:5>DF0BG<MODE:3>FT8<PROP_MODE:0><QSO_DATE:8>20250712<TIME_ON:6>082200<SAT_MODE:0><SAT_NAME:0><STATION_CALLSIGN:5>DG0TM<DCL_QSL_RCVD:1>Y<DCL_QSLRDATE:8>20250911<EOR>"}
|
||||
@@ -13,8 +13,10 @@
|
||||
*/
|
||||
export function parseADIF(adifData) {
|
||||
const qsos = [];
|
||||
// Split by <EOR> (end of record) - case sensitive as per ADIF spec
|
||||
const records = adifData.split('<EOR>');
|
||||
|
||||
// Split by <EOR> (case-insensitive to handle <EOR>, <eor>, <Eor>, etc.)
|
||||
const regex = new RegExp('<eor>', 'gi');
|
||||
const records = adifData.split(regex);
|
||||
|
||||
for (const record of records) {
|
||||
if (!record.trim()) continue;
|
||||
@@ -29,7 +31,6 @@ export function parseADIF(adifData) {
|
||||
|
||||
// Use matchAll for cleaner parsing (creates new iterator for each record)
|
||||
const matches = record.matchAll(/<([A-Z0-9_]+):(\d+)(?::[A-Z]+)?>/gi);
|
||||
let currentPos = 0;
|
||||
|
||||
for (const match of matches) {
|
||||
const [fullMatch, fieldName, lengthStr] = match;
|
||||
@@ -40,8 +41,6 @@ export function parseADIF(adifData) {
|
||||
const value = record.substring(valueStart, valueStart + length);
|
||||
|
||||
qso[fieldName.toLowerCase()] = value.trim();
|
||||
|
||||
currentPos = valueStart + length;
|
||||
}
|
||||
|
||||
// Only add if we have at least a callsign
|
||||
|
||||
Reference in New Issue
Block a user