diff --git a/package.nw/lib/adif.js b/package.nw/lib/adif.js index cb0a579a..c65d3006 100644 --- a/package.nw/lib/adif.js +++ b/package.nw/lib/adif.js @@ -1572,49 +1572,30 @@ function sendToLogger(ADIF) record.COUNTRY = GT.dxccToADIFName[Number(record.DXCC)]; } - if (GT.appSettings.lookupMerge == true) + if (GT.appSettings.lookupMerge == true && record.CALL in GT.lookupCache) { - var request = GT.Idb - .transaction(["lookups"], "readwrite") - .objectStore("lookups") - .get(record.CALL); - - request.onsuccess = function (event) + var lookup = GT.lookupCache[record.CALL]; + for (var key in lookup) { - if (request.result) + if (key in GT.adifLookupMap) { - var lookup = request.result; - for (var key in lookup) - { - if (key in GT.adifLookupMap) - { - record[GT.adifLookupMap[key]] = lookup[key]; - } - } - if ("GRIDSQUARE" in record && "grid" in lookup) - { - if (record.GRIDSQUARE.substr(0, 4) == lookup.grid.substr(0, 4)) - { - record.GRIDSQUARE = lookup.grid; - } - } - if (GT.appSettings.lookupMissingGrid && "grid" in lookup && (!("GRIDSQUARE" in record) || record.GRIDSQUARE.length == 0)) - { - record.GRIDSQUARE = lookup.grid; - } + record[GT.adifLookupMap[key]] = lookup[key]; } - finishSendingReport(record, localMode); - }; - - request.onerror = function (event) + } + if ("GRIDSQUARE" in record && "grid" in lookup) { - finishSendingReport(record, localMode); - }; - } - else - { - finishSendingReport(record, localMode); + if (record.GRIDSQUARE.substr(0, 4) == lookup.grid.substr(0, 4)) + { + record.GRIDSQUARE = lookup.grid; + } + } + if (GT.appSettings.lookupMissingGrid && "grid" in lookup && (!("GRIDSQUARE" in record) || record.GRIDSQUARE.length == 0)) + { + record.GRIDSQUARE = lookup.grid; + } } + + finishSendingReport(record, localMode); } function finishSendingReport(record, localMode)