From f4296b2c24b9e03fb99015c6d613a0cea527feeb Mon Sep 17 00:00:00 2001 From: phl0 Date: Thu, 29 Jun 2023 22:05:04 +0200 Subject: [PATCH] Add error message for no outstanding QO-100 QSOs --- application/models/Stations.php | 4 ++-- application/views/webadif/export.php | 29 +++++++++++++++++++++------- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/application/models/Stations.php b/application/models/Stations.php index 7d9e8823..dca8cd88 100644 --- a/application/models/Stations.php +++ b/application/models/Stations.php @@ -372,14 +372,14 @@ class Stations extends CI_Model { $sql=" SELECT station_profile.station_id, station_profile.station_profile_name, station_profile.station_callsign, notc.c notcount, totc.c totcount FROM station_profile - INNER JOIN ( + LEFT OUTER JOIN ( SELECT qsos.station_id, COUNT(qsos.COL_PRIMARY_KEY) c FROM %s qsos LEFT JOIN webadif ON qsos.COL_PRIMARY_KEY = webadif.qso_id WHERE webadif.qso_id IS NULL AND qsos.COL_SAT_NAME = 'QO-100' GROUP BY qsos.station_id ) notc ON station_profile.station_id = notc.station_id - INNER JOIN ( + LEFT JOIN ( SELECT qsos.station_id, COUNT(qsos.COL_PRIMARY_KEY) c FROM %s qsos WHERE qsos.COL_SAT_NAME = 'QO-100' diff --git a/application/views/webadif/export.php b/application/views/webadif/export.php index 11756f21..f968d582 100644 --- a/application/views/webadif/export.php +++ b/application/views/webadif/export.php @@ -24,6 +24,11 @@ result()) { + $queuedqsos = 0; + foreach ($station_profile->result() as $count) { // Fills the table with the data + $queuedqsos += $count->notcount; + } + if ($queuedqsos > 0) { ?>

You need to set a QO-100 Dx Club API key in your station profile. Only station profiles with an API Key are displayed.

Warning This might take a while as QSO uploads are processed sequentially.

@@ -41,15 +46,25 @@ '; foreach ($station_profile->result() as $station) { // Fills the table with the data - echo ''; - echo '' . $station->station_profile_name . ''; - echo '' . $station->station_callsign . ''; - echo '' . $station->notcount . ''; - echo '' . $station->totcount . ''; - echo ''; - echo ''; + if ($station->notcount != null) { + echo ''; + echo '' . $station->station_profile_name . ''; + echo '' . $station->station_callsign . ''; + echo '' . $station->notcount . ''; + echo '' . $station->totcount . ''; + echo ''; + echo ''; + } } echo ''; + } else { + ?> +
+ There are currently no outstanding QSOs that need to be uploaded to the QO-100 Dx Club's API.
+ Go ahead and turn on your QO-100 station! +
+