Skip to content

Commit

Permalink
Merge branch 'bugfix-563' into testing_0.41
Browse files Browse the repository at this point in the history
  • Loading branch information
foldynl committed Jan 4, 2025
2 parents 8f34d6d + 9ff5fdb commit 7064c88
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions logformat/LogFormat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ unsigned long LogFormat::runImport(QTextStream& importLogStream,
"WHERE callsign=upper(:callsign) "
"AND upper(mode)=upper(:mode) "
"AND upper(band)=upper(:band) "
"AND COALESCE(sat_name, '') = COALESCE(:sat_name, '') "
"AND ABS(JULIANDAY(start_time)-JULIANDAY(datetime(:startdate)))*24*60<30") )
{
qWarning() << "cannot prepare Dup statement";
Expand Down Expand Up @@ -391,7 +392,7 @@ unsigned long LogFormat::runImport(QTextStream& importLogStream,
const QDateTime &start_time = record.value(RECORDIDX(LogbookModel::COLUMN_TIME_ON)).toDateTime();
const QVariant &sota = record.value(RECORDIDX(LogbookModel::COLUMN_SOTA_REF));
const QVariant &mysota = record.value(RECORDIDX(LogbookModel::COLUMN_MY_SOTA_REF));

const QVariant &satName = record.value(RECORDIDX(LogbookModel::COLUMN_SAT_NAME));

/* checking matching fields if they are not empty */
if ( !start_time.isValid()
Expand Down Expand Up @@ -437,6 +438,7 @@ unsigned long LogFormat::runImport(QTextStream& importLogStream,
dupQuery.bindValue(":mode", mode);
dupQuery.bindValue(":band", band);
dupQuery.bindValue(":startdate", start_time.toTimeZone(QTimeZone::utc()).toString("yyyy-MM-dd hh:mm:ss"));
dupQuery.bindValue(":sat_name", satName);

if ( !dupQuery.exec() )
{
Expand Down Expand Up @@ -777,6 +779,7 @@ void LogFormat::runQSLImport(QSLFrom fromService)
const QVariant &band = QSLRecord.value("band");
const QVariant &mode = QSLRecord.value("mode");
const QVariant &start_time = QSLRecord.value("start_time");
const QVariant &satName = QSLRecord.value("sat_name");

/* checking matching fields if they are not empty */
if ( !start_time.toDateTime().isValid()
Expand All @@ -791,10 +794,11 @@ void LogFormat::runQSLImport(QSLFrom fromService)
}

// It is important to use callsign index here
QString matchFilter = QString("callsign=upper('%1') AND upper(mode)=upper('%2') AND upper(band)=upper('%3') AND ABS(JULIANDAY(start_time)-JULIANDAY(datetime('%4')))*24*60<30")
QString matchFilter = QString("callsign=upper('%1') AND upper(mode)=upper('%2') AND upper(band)=upper('%3') AND COALESCE(sat_name, '') = upper('%4') AND ABS(JULIANDAY(start_time)-JULIANDAY(datetime('%5')))*24*60<30")
.arg(call.toString(),
mode.toString(),
band.toString(),
satName.toString(),
start_time.toDateTime().toTimeZone(QTimeZone::utc()).toString("yyyy-MM-dd hh:mm:ss"));

/* set filter */
Expand Down

0 comments on commit 7064c88

Please sign in to comment.