14
14
#include " core/debug.h"
15
15
#include " data/Data.h"
16
16
#include " core/Callsign.h"
17
+ #include " LogParam.h"
17
18
18
19
MODULE_IDENTIFICATION (" qlog.core.membershipqe" );
19
20
@@ -514,22 +515,36 @@ void ClubStatusQuery::getClubStatus(const QString &in_callsign,
514
515
515
516
QSqlDatabase db1 = QSqlDatabase::database (dbConnectionName);
516
517
QSqlQuery query (db1);
517
- Callsign qCall (in_callsign);
518
- QString callModified = ( qCall.isValid () ) ? qCall.getBase () : in_callsign;
518
+ const Callsign qCall (in_callsign);
519
+ const QString &callModified = ( qCall.isValid () ) ? qCall.getBase () : in_callsign;
520
+
521
+ QStringList dxccConfirmedByCond (QLatin1String (" 0=1" )); // if no option is selected then always false
522
+
523
+ if ( LogParam::getDxccConfirmedByLotwState () )
524
+ dxccConfirmedByCond << QLatin1String (" c.lotw_qsl_rcvd = 'Y'" );
525
+
526
+ if ( LogParam::getDxccConfirmedByPaperState () )
527
+ dxccConfirmedByCond << QLatin1String (" c.qsl_rcvd = 'Y'" );
528
+
529
+ if ( LogParam::getDxccConfirmedByEqslState () )
530
+ dxccConfirmedByCond << QLatin1String (" c.eqsl_qsl_rcvd = 'Y'" );
519
531
520
532
if ( ! query.exec (QString (" SELECT DISTINCT clubid, NULL band, NULL mode, "
521
533
" NULL confirmed, NULL current_mode "
522
534
" FROM membership WHERE callsign = '%1' "
523
535
" UNION ALL "
524
536
" SELECT DISTINCT clubid, c.band, o.dxcc mode, "
525
- " CASE WHEN (c.qsl_rcvd = 'Y' OR c.lotw_qsl_rcvd = 'Y' ) THEN 1 ELSE 0 END confirmed, "
526
- " (SELECT modes.dxcc FROM modes WHERE modes.name = '%2 ' LIMIT 1) current_mode "
537
+ " CASE WHEN (%2 ) THEN 1 ELSE 0 END confirmed, "
538
+ " (SELECT modes.dxcc FROM modes WHERE modes.name = '%3 ' LIMIT 1) current_mode "
527
539
" FROM contacts c, "
528
540
" contact_clubs_view con2club, "
529
541
" modes o "
530
542
" WHERE con2club.contactid = c.id "
531
543
" AND o.name = c.mode "
532
- " AND con2club.clubid in (SELECT clubid FROM membership a WHERE a.callsign = '%3') order by 1, 3, 2, 4" ).arg (callModified, in_mode, callModified)))
544
+ " AND con2club.clubid in (SELECT clubid FROM membership a WHERE a.callsign = '%4') order by 1, 3, 2, 4" ).arg (callModified,
545
+ dxccConfirmedByCond.join (" OR " ),
546
+ in_mode,
547
+ callModified)))
533
548
{
534
549
qCWarning (runtime) << " Cannot Get club status" << query.lastError ().text ();
535
550
emit status (in_callsign, QMap<QString, ClubStatus>());
@@ -546,11 +561,11 @@ void ClubStatusQuery::getClubStatus(const QString &in_callsign,
546
561
547
562
while ( ++records && query.next () )
548
563
{
549
- QString clubid = query.value (0 ).toString ();
550
- QString band = query.value (1 ).toString ();
551
- QString mode = query.value (2 ).toString ();
552
- QVariant confirmed = query.value (3 );
553
- QString current_mode = query.value (4 ).toString ();
564
+ const QString & clubid = query.value (0 ).toString ();
565
+ const QString & band = query.value (1 ).toString ();
566
+ const QString & mode = query.value (2 ).toString ();
567
+ const QVariant & confirmed = query.value (3 );
568
+ const QString & current_mode = query.value (4 ).toString ();
554
569
555
570
qCDebug (runtime) << " Processing" << currentProcessedClub
556
571
<< clubid
0 commit comments