From 4ee61eb7eb4a1b6cf61104cfb52cafaf225ef561 Mon Sep 17 00:00:00 2001 From: Andreas Kristiansen <6977712+AndreasK79@users.noreply.github.com> Date: Tue, 24 Feb 2026 21:55:50 +0100 Subject: [PATCH 01/13] [DXCC Award] Started optimizing queries --- application/controllers/Awards.php | 8 +- application/models/Dxcc.php | 427 ++++++++++++++++++++---- application/views/awards/dxcc/index.php | 3 - 3 files changed, 360 insertions(+), 78 deletions(-) diff --git a/application/controllers/Awards.php b/application/controllers/Awards.php index 3379dc64a..7f54cc1ae 100644 --- a/application/controllers/Awards.php +++ b/application/controllers/Awards.php @@ -187,8 +187,10 @@ class Awards extends CI_Controller { if ($dxcclist && $dxcclist[0]->adif == "0") { unset($dxcclist[0]); } - $data['dxcc_array'] = $this->dxcc->get_dxcc_array($dxcclist, $bands, $postdata); - $data['dxcc_summary'] = $this->dxcc->get_dxcc_summary($bands, $postdata); + + $dxcc_result = $this->dxcc->get_dxcc_array($dxcclist, $bands, $postdata); + $data['dxcc_array'] = ($dxcc_result && isset($dxcc_result['matrix'])) ? $dxcc_result['matrix'] : null; + $data['dxcc_summary'] = ($dxcc_result && isset($dxcc_result['summary'])) ? $dxcc_result['summary'] : null; // Render Page $data['page_title'] = sprintf(__("Awards - %s"), __("DXCC")); @@ -1745,7 +1747,7 @@ class Awards extends CI_Controller { unset($dxcclist[0]); } - $dxcc_array = $this->dxcc->get_dxcc_array($dxcclist, $bands, $postdata); + $dxcc_array = $this->dxcc->get_dxcc_array($dxcclist, $bands, $postdata, true); $i = 0; diff --git a/application/models/Dxcc.php b/application/models/Dxcc.php index 06dcfb315..8f04298f6 100644 --- a/application/models/Dxcc.php +++ b/application/models/Dxcc.php @@ -31,7 +31,7 @@ class DXCC extends CI_Model { return $this->db->get('dxcc_entities'); } - function get_dxcc_array($dxccArray, $bands, $postdata) { + function get_dxcc_array($dxccArray, $bands, $postdata, $map = false) { $this->load->model('logbooks_model'); $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); @@ -43,61 +43,235 @@ class DXCC extends CI_Model { $qsl = $this->genfunctions->gen_qsl_from_postdata($postdata); - foreach ($bands as $band) { // Looping through bands and entities to generate the array needed for display - if (($postdata['band'] != 'SAT') && ($band == 'SAT')) { + // Initialize matrix with all DXCC entities + foreach ($dxccArray as $dxcc) { + // Handle both object and array formats + if (is_array($dxcc)) { + $adif = $dxcc['adif'] ?? '0'; + $name = $dxcc['name'] ?? ''; + $prefix = $dxcc['prefix'] ?? ''; + $enddate = $dxcc['end'] ?? null; + } else { + $adif = $dxcc->adif ?? '0'; + $name = $dxcc->name ?? ''; + $prefix = $dxcc->prefix ?? ''; + $enddate = $dxcc->end ?? null; + } + + if ($adif == '0') { + $dxccMatrix[$adif]['name'] = $name; + } else { + $dxccMatrix[$adif]['name'] = ucwords(strtolower($name), "- (/"); + } + $dxccMatrix[$adif]['prefix'] = $prefix; + if ($postdata['includedeleted']) { + $dxccMatrix[$adif]['Deleted'] = isset($enddate) ? 1 : 0; + } + + // Initialize all bands to dash + foreach ($bands as $band) { + $dxccMatrix[$adif][$band] = '-'; + } + } + + // Initialize summary counters only for the bands passed in + foreach ($bands as $band) { + $summary['worked'][$band] = 0; + $summary['confirmed'][$band] = 0; + } + $summary['worked']['Total'] = 0; + $summary['confirmed']['Total'] = 0; + + // Track unique DXCC/band combinations for totals + $workedDxccs = []; // [band][dxcc] => true + $confirmedDxccs = []; // [band][dxcc] => true + + // Track worked status for each DXCC + $dxccWorkedStatus = []; // [dxcc] => count + + // Create a lookup array for valid bands + $validBands = array_flip($bands); + + // Get all DXCC data in efficient queries + $dxccData = $this->getDxccData($location_list, $postdata); + + $dxccDataSat = $this->getDxccDataSat($location_list, $postdata); + + foreach ($dxccData as $dxcc) { + // Skip if this band is not in our requested bands list + if (!isset($validBands[$dxcc->col_band])) { continue; } - foreach ($dxccArray as $dxcc) { - if ($dxcc->adif == '0') { - $dxccMatrix[$dxcc->adif]['name'] = $dxcc->name; + + // Track worked status for this DXCC + if (!isset($dxccWorkedStatus[$dxcc->dxcc])) { + $dxccWorkedStatus[$dxcc->dxcc] = 0; + } + $dxccWorkedStatus[$dxcc->dxcc]++; + + // Check if confirmed based on the confirmation types selected in postdata + $isConfirmed = false; + $confirmationLetters = ''; + if (isset($postdata['qsl']) && $postdata['qsl'] == 1 && $dxcc->qsl > 0) { + $isConfirmed = true; + $confirmationLetters .= 'Q'; + } + if (isset($postdata['lotw']) && $postdata['lotw'] == 1 && $dxcc->lotw > 0) { + $isConfirmed = true; + $confirmationLetters .= 'L'; + } + if (isset($postdata['eqsl']) && $postdata['eqsl'] == 1 && $dxcc->eqsl > 0) { + $isConfirmed = true; + $confirmationLetters .= 'E'; + } + if (isset($postdata['qrz']) && $postdata['qrz'] == 1 && $dxcc->qrz > 0) { + $isConfirmed = true; + $confirmationLetters .= 'Z'; + } + if (isset($postdata['clublog']) && $postdata['clublog'] == 1 && $dxcc->clublog > 0) { + $isConfirmed = true; + $confirmationLetters .= 'C'; + } + + if ($isConfirmed) { + $dxccMatrix[$dxcc->dxcc][$dxcc->col_band] = '
dxcc . '","' . $dxcc->col_band . '","'. $postdata['sat'] . '","'. $postdata['orbit'] . '","'. $postdata['mode'] . '","DXCC","'.$qsl.'","'.$postdata['dateFrom'].'","'.$postdata['dateTo'].'")\'>' . $confirmationLetters . '
'; + // Track confirmed DXCCs for summary + if (!isset($confirmedDxccs[$dxcc->col_band][$dxcc->dxcc])) { + $confirmedDxccs[$dxcc->col_band][$dxcc->dxcc] = true; + $summary['confirmed'][$dxcc->col_band]++; + } + } else { + $dxccMatrix[$dxcc->dxcc][$dxcc->col_band] = '
dxcc . '","' . $dxcc->col_band . '","'. $postdata['sat'] . '","'. $postdata['orbit'] . '","'. $postdata['mode'] . '","DXCC","","'.$postdata['dateFrom'].'","'.$postdata['dateTo'].'")\'>W
'; + } + + // Track worked DXCCs for summary + if (!isset($workedDxccs[$dxcc->col_band][$dxcc->dxcc])) { + $workedDxccs[$dxcc->col_band][$dxcc->dxcc] = true; + $summary['worked'][$dxcc->col_band]++; + } + } + + foreach ($dxccDataSat as $dxcc) { + // Skip if this band is not in our requested bands list + if (!isset($validBands[$dxcc->col_band])) { + continue; + } + + // Track worked status for this DXCC + if (!isset($dxccWorkedStatus[$dxcc->dxcc])) { + $dxccWorkedStatus[$dxcc->dxcc] = 0; + } + $dxccWorkedStatus[$dxcc->dxcc]++; + + // Check if confirmed based on the confirmation types selected in postdata + $isConfirmed = false; + $confirmationLetters = ''; + if (isset($postdata['qsl']) && $postdata['qsl'] == 1 && $dxcc->qsl > 0) { + $isConfirmed = true; + $confirmationLetters .= 'Q'; + } + if (isset($postdata['lotw']) && $postdata['lotw'] == 1 && $dxcc->lotw > 0) { + $isConfirmed = true; + $confirmationLetters .= 'L'; + } + if (isset($postdata['eqsl']) && $postdata['eqsl'] == 1 && $dxcc->eqsl > 0) { + $isConfirmed = true; + $confirmationLetters .= 'E'; + } + if (isset($postdata['qrz']) && $postdata['qrz'] == 1 && $dxcc->qrz > 0) { + $isConfirmed = true; + $confirmationLetters .= 'Z'; + } + if (isset($postdata['clublog']) && $postdata['clublog'] == 1 && $dxcc->clublog > 0) { + $isConfirmed = true; + $confirmationLetters .= 'C'; + } + + if ($isConfirmed) { + $dxccMatrix[$dxcc->dxcc][$dxcc->col_band] = '
dxcc . '","' . $dxcc->col_band . '","'. $postdata['sat'] . '","'. $postdata['orbit'] . '","'. $postdata['mode'] . '","DXCC","'.$qsl.'","'.$postdata['dateFrom'].'","'.$postdata['dateTo'].'")\'>' . $confirmationLetters . '
'; + // Track confirmed DXCCs for summary + if (!isset($confirmedDxccs[$dxcc->col_band][$dxcc->dxcc])) { + $confirmedDxccs[$dxcc->col_band][$dxcc->dxcc] = true; + $summary['confirmed'][$dxcc->col_band]++; + } + } else { + $dxccMatrix[$dxcc->dxcc][$dxcc->col_band] = '
dxcc . '","' . $dxcc->col_band . '","'. $postdata['sat'] . '","'. $postdata['orbit'] . '","'. $postdata['mode'] . '","DXCC","","'.$postdata['dateFrom'].'","'.$postdata['dateTo'].'")\'>W
'; + } + + // Track worked DXCCs for summary + if (!isset($workedDxccs[$dxcc->col_band][$dxcc->dxcc])) { + $workedDxccs[$dxcc->col_band][$dxcc->dxcc] = true; + $summary['worked'][$dxcc->col_band]++; + } + } + + // Calculate totals across all bands (excluding SAT) + $totalWorkedDxccs = []; + $totalConfirmedDxccs = []; + foreach ($workedDxccs as $band => $dxccs) { + // Skip SAT for totals + if ($band === 'SAT') { + continue; + } + foreach ($dxccs as $dxcc => $true) { + if (!isset($totalWorkedDxccs[$dxcc])) { + $totalWorkedDxccs[$dxcc] = true; + $summary['worked']['Total']++; + } + } + } + foreach ($confirmedDxccs as $band => $dxccs) { + // Skip SAT for totals + if ($band === 'SAT') { + continue; + } + foreach ($dxccs as $dxcc => $true) { + if (!isset($totalConfirmedDxccs[$dxcc])) { + $totalConfirmedDxccs[$dxcc] = true; + $summary['confirmed']['Total']++; + } + } + } + + // Remove DXCCs based on postdata filters + foreach ($dxccMatrix as $dxcc => $data) { + // Remove not-worked DXCCs if filter is disabled + if ($postdata['notworked'] == NULL && !isset($dxccWorkedStatus[$dxcc])) { + unset($dxccMatrix[$dxcc]); + continue; + } + + // Remove worked-only DXCCs if filter is disabled + if ($postdata['worked'] == NULL && isset($dxccWorkedStatus[$dxcc]) && !isset($totalConfirmedDxccs[$dxcc])) { + unset($dxccMatrix[$dxcc]); + continue; + } + + // Remove confirmed DXCCs if filter is disabled + if ($postdata['confirmed'] == NULL && isset($totalConfirmedDxccs[$dxcc])) { + unset($dxccMatrix[$dxcc]); + continue; + } + } + + // If this is for the map, return simplified format + if ($map) { + $mapDxccs = []; + foreach ($dxccMatrix as $dxcc => $data) { + if (!isset($dxccWorkedStatus[$dxcc])) { + $mapDxccs[$dxcc] = '-'; // Not worked + } elseif (isset($totalConfirmedDxccs[$dxcc])) { + $mapDxccs[$dxcc] = 'C'; // Confirmed } else { - $dxccMatrix[$dxcc->adif]['name'] = ucwords(strtolower($dxcc->name), "- (/"); - } - $dxccMatrix[$dxcc->adif]['Dxccprefix'] = $dxcc->prefix; - if ($postdata['includedeleted']) - $dxccMatrix[$dxcc->adif]['Deleted'] = isset($dxcc->Enddate) ? 1 : 0; - $dxccMatrix[$dxcc->adif][$band] = '-'; - } - - // If worked is checked, we add worked entities to the array - if ($postdata['worked'] != NULL) { - $workedDXCC = $this->getDxccBandWorked($location_list, $band, $postdata); - foreach ($workedDXCC as $wdxcc) { - $dxccMatrix[$wdxcc->dxcc][$band] = '
dxcc.'","'. $band . '","'. $postdata['sat'] . '","' . $postdata['orbit'] . '","'. $postdata['mode'] . '","DXCC2", "", "'.$postdata['dateFrom'].'", "'.$postdata['dateTo'].'")\'>W
'; - } - } - - // If confirmed is checked, we add confirmed entities to the array - if ($postdata['confirmed'] != NULL) { - $confirmedDXCC = $this->getDxccBandConfirmed($location_list, $band, $postdata); - foreach ($confirmedDXCC as $cdxcc) { - $dxccMatrix[$cdxcc->dxcc][$band] = '
dxcc.'","'. $band . '","'. $postdata['sat'] . '","'. $postdata['orbit'] . '","' . $postdata['mode'] . '","DXCC2","'.$qsl.'","'.$postdata['dateFrom'].'","'.$postdata['dateTo'].'")\'>'.$this->cf_type($postdata, $cdxcc->qsl,$cdxcc->lotw, $cdxcc->eqsl, $cdxcc->qrz, $cdxcc->clublog).'
'; - } - } - } - - // We want to remove the worked dxcc's in the list, since we do not want to display them - if ($postdata['worked'] == NULL) { - $workedDxcc = $this->getDxccWorked($location_list, $postdata); - foreach ($workedDxcc as $wdxcc) { - if (array_key_exists($wdxcc->dxcc, $dxccMatrix)) { - unset($dxccMatrix[$wdxcc->dxcc]); - } - } - } - - // We want to remove the confirmed dxcc's in the list, since we do not want to display them - if ($postdata['confirmed'] == NULL) { - $confirmedDxcc = $this->getDxccConfirmed($location_list, $postdata); - foreach ($confirmedDxcc as $cdxcc) { - if (array_key_exists($cdxcc->dxcc, $dxccMatrix)) { - unset($dxccMatrix[$cdxcc->dxcc]); + $mapDxccs[$dxcc] = 'W'; // Worked but not confirmed } } + return $mapDxccs; } if (isset($dxccMatrix)) { - return $dxccMatrix; + // Return both the matrix data and summary + return ['matrix' => $dxccMatrix, 'summary' => $summary]; } else { return 0; } @@ -114,24 +288,128 @@ class DXCC extends CI_Model { return $string; } - function getDxccBandConfirmed($location_list, $band, $postdata) { + /* + * Gets all DXCC data with confirmation status in efficient query using MAX aggregation + * Returns both regular bands and satellite data + */ + function getDxccData($location_list, $postdata) { + $bindings = []; + $sql = "SELECT thcv.col_dxcc as dxcc, thcv.col_band, + MAX(case when thcv.col_lotw_qsl_rcvd ='Y' then 1 else 0 end) as lotw, + MAX(case when thcv.col_qsl_rcvd = 'Y' then 1 else 0 end) as qsl, + MAX(case when thcv.col_eqsl_qsl_rcvd = 'Y' then 1 else 0 end) as eqsl, + MAX(case when thcv.COL_QRZCOM_QSO_DOWNLOAD_STATUS= 'Y' then 1 else 0 end) as qrz, + MAX(case when thcv.COL_CLUBLOG_QSO_DOWNLOAD_STATUS = 'Y' then 1 else 0 end) as clublog + FROM " . $this->config->item('table_name') . " thcv + WHERE station_id IN (" . $location_list . ") AND thcv.col_dxcc > 0"; + + // Mode filter + if ($postdata['mode'] != 'All') { + $sql .= " AND (thcv.col_mode = ? OR thcv.col_submode = ?)"; + $bindings[] = $postdata['mode']; + $bindings[] = $postdata['mode']; + } + + // Date filters + if ($postdata['dateFrom'] != NULL) { + $sql .= " AND thcv.col_time_on >= ?"; + $bindings[] = $postdata['dateFrom'] . ' 00:00:00'; + } + + if ($postdata['dateTo'] != NULL) { + $sql .= " AND thcv.col_time_on <= ?"; + $bindings[] = $postdata['dateTo'] . ' 23:59:59'; + } + + $sql .= " and thcv.col_prop_mode != 'SAT'"; + + // Continent filters + $sql .= $this->addContinentsToQuery($postdata); + + // Deleted DXCC filter + if ($postdata['includedeleted'] == NULL) { + $sql .= " AND (SELECT end FROM dxcc_entities d WHERE d.adif = thcv.col_dxcc) IS NULL"; + } + + $sql .= " GROUP BY thcv.col_dxcc, thcv.col_band"; + + $query = $this->db->query($sql, $bindings); + return $query->result(); + } + + function getDxccDataSat($location_list, $postdata) { + $bindings = []; + $sql = "SELECT thcv.col_dxcc as dxcc, 'SAT' as col_band, + MAX(case when thcv.col_lotw_qsl_rcvd ='Y' then 1 else 0 end) as lotw, + MAX(case when thcv.col_qsl_rcvd = 'Y' then 1 else 0 end) as qsl, + MAX(case when thcv.col_eqsl_qsl_rcvd = 'Y' then 1 else 0 end) as eqsl, + MAX(case when thcv.COL_QRZCOM_QSO_DOWNLOAD_STATUS= 'Y' then 1 else 0 end) as qrz, + MAX(case when thcv.COL_CLUBLOG_QSO_DOWNLOAD_STATUS = 'Y' then 1 else 0 end) as clublog + FROM " . $this->config->item('table_name') . " thcv + LEFT JOIN satellite on thcv.COL_SAT_NAME = satellite.name + WHERE station_id IN (" . $location_list . ") AND thcv.col_dxcc > 0"; + + // Mode filter + if ($postdata['mode'] != 'All') { + $sql .= " AND (thcv.col_mode = ? OR thcv.col_submode = ?)"; + $bindings[] = $postdata['mode']; + $bindings[] = $postdata['mode']; + } + + // Date filters + if ($postdata['dateFrom'] != NULL) { + $sql .= " AND thcv.col_time_on >= ?"; + $bindings[] = $postdata['dateFrom'] . ' 00:00:00'; + } + + if ($postdata['dateTo'] != NULL) { + $sql .= " AND thcv.col_time_on <= ?"; + $bindings[] = $postdata['dateTo'] . ' 23:59:59'; + } + + // Satellite filter + if ($postdata['sat'] != 'All') { + $sql .= " AND thcv.col_sat_name = ?"; + $bindings[] = $postdata['sat']; + } + + // Orbit filter + $sql .= $this->addOrbitToQuery($postdata, $bindings); + + // Continent filters + $sql .= $this->addContinentsToQuery($postdata); + + // Deleted DXCC filter + if ($postdata['includedeleted'] == NULL) { + $sql .= " AND (SELECT end FROM dxcc_entities d WHERE d.adif = thcv.col_dxcc) IS NULL"; + } + + $sql .= " and col_prop_mode = 'SAT'"; + + $sql .= " GROUP BY thcv.col_dxcc"; + + $query = $this->db->query($sql, $bindings); + return $query->result(); + } + + function getDxccBandConfirmed($location_list, $postdata) { $bindings=[]; $sql = "select adif as dxcc, name, lotw, qsl, eqsl, qrz, clublog from dxcc_entities join ( - select col_dxcc, sum(case when thcv.col_lotw_qsl_rcvd ='Y' then 1 else 0 end) as lotw,sum(case when thcv.col_qsl_rcvd = 'Y' then 1 else 0 end) as qsl,sum(case when thcv.col_eqsl_qsl_rcvd = 'Y' then 1 else 0 end) as eqsl,sum(case when thcv.COL_QRZCOM_QSO_DOWNLOAD_STATUS= 'Y' then 1 else 0 end) as qrz,sum(case when thcv.COL_CLUBLOG_QSO_DOWNLOAD_STATUS = 'Y' then 1 else 0 end) as clublog from ".$this->config->item('table_name')." thcv + select col_dxcc, + sum(case when thcv.col_lotw_qsl_rcvd ='Y' then 1 else 0 end) as lotw, + sum(case when thcv.col_qsl_rcvd = 'Y' then 1 else 0 end) as qsl, + sum(case when thcv.col_eqsl_qsl_rcvd = 'Y' then 1 else 0 end) as eqsl, + sum(case when thcv.COL_QRZCOM_QSO_DOWNLOAD_STATUS= 'Y' then 1 else 0 end) as qrz, + sum(case when thcv.COL_CLUBLOG_QSO_DOWNLOAD_STATUS = 'Y' then 1 else 0 end) as clublog + from ".$this->config->item('table_name')." thcv LEFT JOIN satellite on thcv.COL_SAT_NAME = satellite.name where station_id in (" . $location_list . - ") and col_dxcc > 0"; + ") and col_dxcc > 0"; - $sql .= $this->genfunctions->addBandToQuery($band,$bindings); - if ($band == 'SAT') { - $sql .= " and col_prop_mode='SAT'"; - if ($postdata['sat'] != 'All') { - $sql .= " and col_sat_name = ?"; - $bindings[]=$postdata['sat']; - } - } else { - $sql.=" and (col_prop_mode!='SAT' or col_prop_mode is null)"; + if ($postdata['sat'] != 'All') { + $sql .= " and col_sat_name = ?"; + $bindings[]=$postdata['sat']; } if ($postdata['mode'] != 'All') { @@ -462,6 +740,7 @@ class DXCC extends CI_Model { /* * Function gets worked and confirmed summary on each band on the active stationprofile + * Now uses data from get_dxcc_array instead of separate queries - much more efficient! */ function get_dxcc_summary($bands, $postdata) { $this->load->model('logbooks_model'); @@ -473,20 +752,24 @@ class DXCC extends CI_Model { $location_list = "'".implode("','",$logbooks_locations_array)."'"; - foreach ($bands as $band) { - $worked = $this->getSummaryByBand($band, $postdata, $location_list); - $confirmed = $this->getSummaryByBandConfirmed($band, $postdata, $location_list); - $dxccSummary['worked'][$band] = $worked[0]->count; - $dxccSummary['confirmed'][$band] = $confirmed[0]->count; - $dxccSummary['confirmed_lotw'][$band] = $confirmed[0]->lotw; - $dxccSummary['confirmed_qsl'][$band] = $confirmed[0]->qsl; + // Get all DXCC entities + $this->load->model('dxcc'); + $dxccEntities = $this->dxcc->list_current(); + + $result = $this->get_dxcc_array($dxccEntities, $bands, $postdata); + + if ($result && isset($result['summary'])) { + return $result['summary']; } - $workedTotal = $this->getSummaryByBand($postdata['band'], $postdata, $location_list); - $confirmedTotal = $this->getSummaryByBandConfirmed($postdata['band'], $postdata, $location_list); - - $dxccSummary['worked']['Total'] = $workedTotal[0]->count; - $dxccSummary['confirmed']['Total'] = $confirmedTotal[0]->count; + // Fallback to empty structure if something went wrong + $dxccSummary = []; + foreach ($bands as $band) { + $dxccSummary['worked'][$band] = '-'; + $dxccSummary['confirmed'][$band] = '-'; + } + $dxccSummary['worked']['Total'] = '-'; + $dxccSummary['confirmed']['Total'] = '-'; return $dxccSummary; } diff --git a/application/views/awards/dxcc/index.php b/application/views/awards/dxcc/index.php index e249ec260..713b66160 100644 --- a/application/views/awards/dxcc/index.php +++ b/application/views/awards/dxcc/index.php @@ -275,9 +275,6 @@ ' . __("DXCC Name") . ' ' . __("Prefix") . ''; foreach($bands as $band) { - if (($posted_band != 'SAT') && ($band == 'SAT')) { - continue; - } echo '' . $band . ''; } echo ' From 896718de11bad9b451457c9ff058aefafe4d1f68 Mon Sep 17 00:00:00 2001 From: Andreas Kristiansen <6977712+AndreasK79@users.noreply.github.com> Date: Fri, 27 Feb 2026 10:27:32 +0100 Subject: [PATCH 02/13] Adjustments, award works, map left --- application/controllers/Awards.php | 120 +++--- application/models/Dxcc.php | 497 ++---------------------- application/views/awards/dxcc/index.php | 12 +- 3 files changed, 114 insertions(+), 515 deletions(-) diff --git a/application/controllers/Awards.php b/application/controllers/Awards.php index f795eda5e..b03a30d31 100644 --- a/application/controllers/Awards.php +++ b/application/controllers/Awards.php @@ -110,6 +110,9 @@ class Awards extends CI_Controller { $this->load->model('dxcc'); $this->load->model('modes'); $this->load->model('bands'); + $this->load->model('logbooks_model'); + + $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); $data['orbits'] = $this->bands->get_worked_orbits(); $data['sats_available'] = $this->bands->get_worked_sats(); @@ -183,14 +186,22 @@ class Awards extends CI_Controller { $postdata['dateTo'] = null; } - $dxcclist = $this->dxcc->fetchdxcc($postdata); - if ($dxcclist && $dxcclist[0]->adif == "0") { - unset($dxcclist[0]); - } - $dxcc_result = $this->dxcc->get_dxcc_array($dxcclist, $bands, $postdata); - $data['dxcc_array'] = ($dxcc_result && isset($dxcc_result['matrix'])) ? $dxcc_result['matrix'] : null; - $data['dxcc_summary'] = ($dxcc_result && isset($dxcc_result['summary'])) ? $dxcc_result['summary'] : null; + if ($logbooks_locations_array) { + $location_list = "'".implode("','",$logbooks_locations_array)."'"; + $dxcclist = $this->dxcc->fetchdxcc($postdata, $location_list); + if ($dxcclist && $dxcclist[0]->adif == "0") { + unset($dxcclist[0]); + } + $dxcc_result = $this->dxcc->get_dxcc_array($dxcclist, $bands, $postdata, $location_list); + // Extract bands data and summary from the result + $data['dxcc_array'] = ($dxcc_result && isset($dxcc_result['matrix'])) ? $dxcc_result['matrix'] : null; + $data['dxcc_summary'] = ($dxcc_result && isset($dxcc_result['summary'])) ? $dxcc_result['summary'] : null; + } else { + $location_list = null; + $data['dxcc_array'] = null; + $data['dxcc_summary'] = null; + } // Render Page $data['page_title'] = sprintf(__("Awards - %s"), __("DXCC")); @@ -1705,59 +1716,70 @@ class Awards extends CI_Controller { This displays the DXCC map */ public function dxcc_map() { - $this->load->model('dxcc'); - $this->load->model('bands'); + $this->load->model('dxcc'); + $this->load->model('bands'); - $bands[] = $this->security->xss_clean($this->input->post('band')); + $bands[] = $this->security->xss_clean($this->input->post('band')); - $postdata['qsl'] = ($this->input->post('qsl',true) ?? 0) == 0 ? NULL: 1; - $postdata['lotw'] = ($this->input->post('lotw',true) ?? 0) == 0 ? NULL: 1; - $postdata['eqsl'] = ($this->input->post('eqsl',true) ?? 0) == 0 ? NULL: 1; - $postdata['qrz'] = ($this->input->post('qrz',true) ?? 0) == 0 ? NULL: 1; - $postdata['clublog'] = ($this->input->post('clublog',true) ?? 0) == 0 ? NULL: 1; - $postdata['worked'] = ($this->input->post('worked',true) ?? 0) == 0 ? NULL: 1; - $postdata['confirmed'] = ($this->input->post('confirmed',true) ?? 0) == 0 ? NULL: 1; - $postdata['notworked'] = ($this->input->post('notworked',true) ?? 0) == 0 ? NULL: 1; + $postdata['qsl'] = ($this->input->post('qsl',true) ?? 0) == 0 ? NULL: 1; + $postdata['lotw'] = ($this->input->post('lotw',true) ?? 0) == 0 ? NULL: 1; + $postdata['eqsl'] = ($this->input->post('eqsl',true) ?? 0) == 0 ? NULL: 1; + $postdata['qrz'] = ($this->input->post('qrz',true) ?? 0) == 0 ? NULL: 1; + $postdata['clublog'] = ($this->input->post('clublog',true) ?? 0) == 0 ? NULL: 1; + $postdata['worked'] = ($this->input->post('worked',true) ?? 0) == 0 ? NULL: 1; + $postdata['confirmed'] = ($this->input->post('confirmed',true) ?? 0) == 0 ? NULL: 1; + $postdata['notworked'] = ($this->input->post('notworked',true) ?? 0) == 0 ? NULL: 1; - $postdata['includedeleted'] = ($this->input->post('includedeleted',true) ?? 0) == 0 ? NULL: 1; - $postdata['Africa'] = ($this->input->post('Africa',true) ?? 0) == 0 ? NULL: 1; - $postdata['Asia'] = ($this->input->post('Asia',true) ?? 0) == 0 ? NULL: 1; - $postdata['Europe'] = ($this->input->post('Europe',true) ?? 0) == 0 ? NULL: 1; - $postdata['NorthAmerica'] = ($this->input->post('NorthAmerica',true) ?? 0) == 0 ? NULL: 1; - $postdata['SouthAmerica'] = ($this->input->post('SouthAmerica',true) ?? 0) == 0 ? NULL: 1; - $postdata['Oceania'] = ($this->input->post('Oceania',true) ?? 0) == 0 ? NULL: 1; - $postdata['Antarctica'] = ($this->input->post('Antarctica',true) ?? 0) == 0 ? NULL: 1; - $postdata['band'] = $this->security->xss_clean($this->input->post('band')); - $postdata['mode'] = $this->security->xss_clean($this->input->post('mode')); - $postdata['sat'] = $this->security->xss_clean($this->input->post('sat')); - $postdata['orbit'] = $this->security->xss_clean($this->input->post('orbit')); + $postdata['includedeleted'] = ($this->input->post('includedeleted',true) ?? 0) == 0 ? NULL: 1; + $postdata['Africa'] = ($this->input->post('Africa',true) ?? 0) == 0 ? NULL: 1; + $postdata['Asia'] = ($this->input->post('Asia',true) ?? 0) == 0 ? NULL: 1; + $postdata['Europe'] = ($this->input->post('Europe',true) ?? 0) == 0 ? NULL: 1; + $postdata['NorthAmerica'] = ($this->input->post('NorthAmerica',true) ?? 0) == 0 ? NULL: 1; + $postdata['SouthAmerica'] = ($this->input->post('SouthAmerica',true) ?? 0) == 0 ? NULL: 1; + $postdata['Oceania'] = ($this->input->post('Oceania',true) ?? 0) == 0 ? NULL: 1; + $postdata['Antarctica'] = ($this->input->post('Antarctica',true) ?? 0) == 0 ? NULL: 1; + $postdata['band'] = $this->security->xss_clean($this->input->post('band')); + $postdata['mode'] = $this->security->xss_clean($this->input->post('mode')); + $postdata['sat'] = $this->security->xss_clean($this->input->post('sat')); + $postdata['orbit'] = $this->security->xss_clean($this->input->post('orbit')); $postdata['dateFrom'] = $this->security->xss_clean($this->input->post('dateFrom')); $postdata['dateTo'] = $this->security->xss_clean($this->input->post('dateTo')); - $dxcclist = $this->dxcc->fetchdxcc($postdata); - if ($dxcclist[0]->adif == "0") { - unset($dxcclist[0]); - } + $this->load->model('logbooks_model'); + $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); - $dxcc_array = $this->dxcc->get_dxcc_array($dxcclist, $bands, $postdata, true); + $dxcclist = $this->dxcc->fetchdxcc($postdata, $logbooks_locations_array); - $i = 0; + if ($dxcclist[0]->adif == "0") { + unset($dxcclist[0]); + } - foreach ($dxcclist as $dxcc) { - $newdxcc[$i]['adif'] = $dxcc->adif; - $newdxcc[$i]['prefix'] = $dxcc->prefix; - $newdxcc[$i]['name'] = ucwords(strtolower($dxcc->name), "- (/"); - if ($dxcc->Enddate!=null) { - $newdxcc[$i]['name'] .= ' (deleted)'; - } - $newdxcc[$i]['lat'] = $dxcc->lat; - $newdxcc[$i]['long'] = $dxcc->long; - $newdxcc[$i++]['status'] = isset($dxcc_array[$dxcc->adif]) ? $this->returnStatus($dxcc_array[$dxcc->adif]) : 'x'; - } + if ($logbooks_locations_array) { + $location_list = "'".implode("','",$logbooks_locations_array)."'"; + $dxcc_array = $this->dxcc->get_dxcc_array($dxcclist, $bands, $postdata, $location_list, true); + } else { + $location_list = null; + $dxcc_array = array(); + } - header('Content-Type: application/json'); - echo json_encode($newdxcc); + $i = 0; + + foreach ($dxcclist as $dxcc) { + $newdxcc[$i]['adif'] = $dxcc->adif; + $newdxcc[$i]['prefix'] = $dxcc->prefix; + $newdxcc[$i]['name'] = ucwords(strtolower($dxcc->name), "- (/"); + if ($dxcc->Enddate!=null) { + $newdxcc[$i]['name'] .= ' (deleted)'; + } + $newdxcc[$i]['lat'] = $dxcc->lat; + $newdxcc[$i]['long'] = $dxcc->long; + $newdxcc[$i++]['status'] = isset($dxcc_array[$dxcc->adif]) ? $dxcc_array[$dxcc->adif] : 'x'; + } + + + header('Content-Type: application/json'); + echo json_encode($newdxcc); } /* diff --git a/application/models/Dxcc.php b/application/models/Dxcc.php index 8f04298f6..4469f8b05 100644 --- a/application/models/Dxcc.php +++ b/application/models/Dxcc.php @@ -31,32 +31,15 @@ class DXCC extends CI_Model { return $this->db->get('dxcc_entities'); } - function get_dxcc_array($dxccArray, $bands, $postdata, $map = false) { - $this->load->model('logbooks_model'); - $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); - - if (!$logbooks_locations_array) { - return null; - } - - $location_list = "'".implode("','",$logbooks_locations_array)."'"; - + function get_dxcc_array($dxccArray, $bands, $postdata, $location_list, $map = false) { $qsl = $this->genfunctions->gen_qsl_from_postdata($postdata); // Initialize matrix with all DXCC entities foreach ($dxccArray as $dxcc) { - // Handle both object and array formats - if (is_array($dxcc)) { - $adif = $dxcc['adif'] ?? '0'; - $name = $dxcc['name'] ?? ''; - $prefix = $dxcc['prefix'] ?? ''; - $enddate = $dxcc['end'] ?? null; - } else { - $adif = $dxcc->adif ?? '0'; - $name = $dxcc->name ?? ''; - $prefix = $dxcc->prefix ?? ''; - $enddate = $dxcc->end ?? null; - } + $adif = $dxcc->adif ?? '0'; + $name = $dxcc->name ?? ''; + $prefix = $dxcc->prefix ?? ''; + $enddate = $dxcc->end ?? null; if ($adif == '0') { $dxccMatrix[$adif]['name'] = $name; @@ -103,11 +86,14 @@ class DXCC extends CI_Model { continue; } + // Ensure string key for consistency + $dxccKey = (string)$dxcc->dxcc; + // Track worked status for this DXCC - if (!isset($dxccWorkedStatus[$dxcc->dxcc])) { - $dxccWorkedStatus[$dxcc->dxcc] = 0; + if (!isset($dxccWorkedStatus[$dxccKey])) { + $dxccWorkedStatus[$dxccKey] = 0; } - $dxccWorkedStatus[$dxcc->dxcc]++; + $dxccWorkedStatus[$dxccKey]++; // Check if confirmed based on the confirmation types selected in postdata $isConfirmed = false; @@ -134,19 +120,19 @@ class DXCC extends CI_Model { } if ($isConfirmed) { - $dxccMatrix[$dxcc->dxcc][$dxcc->col_band] = '
dxcc . '","' . $dxcc->col_band . '","'. $postdata['sat'] . '","'. $postdata['orbit'] . '","'. $postdata['mode'] . '","DXCC","'.$qsl.'","'.$postdata['dateFrom'].'","'.$postdata['dateTo'].'")\'>' . $confirmationLetters . '
'; + $dxccMatrix[$dxccKey][$dxcc->col_band] = '
dxcc.'","'. $dxcc->col_band . '","'. $postdata['sat'] . '","'. $postdata['orbit'] . '","' . $postdata['mode'] . '","DXCC2","'.$qsl.'","'.$postdata['dateFrom'].'","'.$postdata['dateTo'].'")\'>'.$confirmationLetters.'
'; // Track confirmed DXCCs for summary - if (!isset($confirmedDxccs[$dxcc->col_band][$dxcc->dxcc])) { - $confirmedDxccs[$dxcc->col_band][$dxcc->dxcc] = true; + if (!isset($confirmedDxccs[$dxcc->col_band][$dxccKey])) { + $confirmedDxccs[$dxcc->col_band][$dxccKey] = true; $summary['confirmed'][$dxcc->col_band]++; } } else { - $dxccMatrix[$dxcc->dxcc][$dxcc->col_band] = '
dxcc . '","' . $dxcc->col_band . '","'. $postdata['sat'] . '","'. $postdata['orbit'] . '","'. $postdata['mode'] . '","DXCC","","'.$postdata['dateFrom'].'","'.$postdata['dateTo'].'")\'>W
'; + $dxccMatrix[$dxccKey][$dxcc->col_band] = '
dxcc.'","'. $dxcc->col_band . '","'. $postdata['sat'] . '","' . $postdata['orbit'] . '","'. $postdata['mode'] . '","DXCC2", "", "'.$postdata['dateFrom'].'", "'.$postdata['dateTo'].'")\'>W
'; } // Track worked DXCCs for summary - if (!isset($workedDxccs[$dxcc->col_band][$dxcc->dxcc])) { - $workedDxccs[$dxcc->col_band][$dxcc->dxcc] = true; + if (!isset($workedDxccs[$dxcc->col_band][$dxccKey])) { + $workedDxccs[$dxcc->col_band][$dxccKey] = true; $summary['worked'][$dxcc->col_band]++; } } @@ -157,11 +143,14 @@ class DXCC extends CI_Model { continue; } + // Ensure string key for consistency + $dxccKey = (string)$dxcc->dxcc; + // Track worked status for this DXCC - if (!isset($dxccWorkedStatus[$dxcc->dxcc])) { - $dxccWorkedStatus[$dxcc->dxcc] = 0; + if (!isset($dxccWorkedStatus[$dxccKey])) { + $dxccWorkedStatus[$dxccKey] = 0; } - $dxccWorkedStatus[$dxcc->dxcc]++; + $dxccWorkedStatus[$dxccKey]++; // Check if confirmed based on the confirmation types selected in postdata $isConfirmed = false; @@ -188,19 +177,19 @@ class DXCC extends CI_Model { } if ($isConfirmed) { - $dxccMatrix[$dxcc->dxcc][$dxcc->col_band] = '
dxcc . '","' . $dxcc->col_band . '","'. $postdata['sat'] . '","'. $postdata['orbit'] . '","'. $postdata['mode'] . '","DXCC","'.$qsl.'","'.$postdata['dateFrom'].'","'.$postdata['dateTo'].'")\'>' . $confirmationLetters . '
'; + $dxccMatrix[$dxccKey][$dxcc->col_band] = '
dxcc.'","'. $dxcc->col_band . '","'. $postdata['sat'] . '","'. $postdata['orbit'] . '","' . $postdata['mode'] . '","DXCC2","'.$qsl.'","'.$postdata['dateFrom'].'","'.$postdata['dateTo'].'")\'>'.$confirmationLetters.'
'; // Track confirmed DXCCs for summary - if (!isset($confirmedDxccs[$dxcc->col_band][$dxcc->dxcc])) { - $confirmedDxccs[$dxcc->col_band][$dxcc->dxcc] = true; + if (!isset($confirmedDxccs[$dxcc->col_band][$dxccKey])) { + $confirmedDxccs[$dxcc->col_band][$dxccKey] = true; $summary['confirmed'][$dxcc->col_band]++; - } - } else { - $dxccMatrix[$dxcc->dxcc][$dxcc->col_band] = '
dxcc . '","' . $dxcc->col_band . '","'. $postdata['sat'] . '","'. $postdata['orbit'] . '","'. $postdata['mode'] . '","DXCC","","'.$postdata['dateFrom'].'","'.$postdata['dateTo'].'")\'>W
'; + } + } else { + $dxccMatrix[$dxccKey][$dxcc->col_band] = '
dxcc.'","'. $dxcc->col_band . '","'. $postdata['sat'] . '","' . $postdata['orbit'] . '","'. $postdata['mode'] . '","DXCC2", "", "'.$postdata['dateFrom'].'", "'.$postdata['dateTo'].'")\'>W
'; } // Track worked DXCCs for summary - if (!isset($workedDxccs[$dxcc->col_band][$dxcc->dxcc])) { - $workedDxccs[$dxcc->col_band][$dxcc->dxcc] = true; + if (!isset($workedDxccs[$dxcc->col_band][$dxccKey])) { + $workedDxccs[$dxcc->col_band][$dxccKey] = true; $summary['worked'][$dxcc->col_band]++; } } @@ -258,7 +247,7 @@ class DXCC extends CI_Model { if ($map) { $mapDxccs = []; foreach ($dxccMatrix as $dxcc => $data) { - if (!isset($dxccWorkedStatus[$dxcc])) { + if (!isset($totalWorkedDxccs[$dxcc])) { $mapDxccs[$dxcc] = '-'; // Not worked } elseif (isset($totalConfirmedDxccs[$dxcc])) { $mapDxccs[$dxcc] = 'C'; // Confirmed @@ -277,20 +266,8 @@ class DXCC extends CI_Model { } } - private function cf_type($postdata,$qsl,$lotw,$eqsl,$qrz,$clublog) { - $string=''; - if ((($qsl ?? 0)>0) && (($postdata['qsl'] ?? '') != '')) { $string.='Q'; } - if ((($lotw ?? 0)>0) && (($postdata['lotw'] ?? '') != '')) { $string.='L'; } - if ((($eqsl ?? 0)>0) && (($postdata['eqsl'] ?? '') != '')) { $string.='E'; } - if ((($qrz ?? 0)>0) && (($postdata['qrz'] ?? '') != '')) { $string.='Z'; } - if ((($clublog ?? 0)>0) && (($postdata['clublog'] ?? '') != '')) { $string.='C'; } - if ($string == '') { $string='C'; } - return $string; - } - /* * Gets all DXCC data with confirmation status in efficient query using MAX aggregation - * Returns both regular bands and satellite data */ function getDxccData($location_list, $postdata) { $bindings = []; @@ -392,118 +369,8 @@ class DXCC extends CI_Model { return $query->result(); } - function getDxccBandConfirmed($location_list, $postdata) { + function fetchDxcc($postdata, $location_list) { $bindings=[]; - $sql = "select adif as dxcc, name, lotw, qsl, eqsl, qrz, clublog from dxcc_entities - join ( - select col_dxcc, - sum(case when thcv.col_lotw_qsl_rcvd ='Y' then 1 else 0 end) as lotw, - sum(case when thcv.col_qsl_rcvd = 'Y' then 1 else 0 end) as qsl, - sum(case when thcv.col_eqsl_qsl_rcvd = 'Y' then 1 else 0 end) as eqsl, - sum(case when thcv.COL_QRZCOM_QSO_DOWNLOAD_STATUS= 'Y' then 1 else 0 end) as qrz, - sum(case when thcv.COL_CLUBLOG_QSO_DOWNLOAD_STATUS = 'Y' then 1 else 0 end) as clublog - from ".$this->config->item('table_name')." thcv - LEFT JOIN satellite on thcv.COL_SAT_NAME = satellite.name - where station_id in (" . $location_list . - ") and col_dxcc > 0"; - - if ($postdata['sat'] != 'All') { - $sql .= " and col_sat_name = ?"; - $bindings[]=$postdata['sat']; - } - - if ($postdata['mode'] != 'All') { - $sql .= " and (col_mode = ? or col_submode = ?)"; - $bindings[]=$postdata['mode']; - $bindings[]=$postdata['mode']; - } - - $sql .= $this->addOrbitToQuery($postdata,$bindings); - - $sql .= $this->genfunctions->addQslToQuery($postdata); - - if ($postdata['dateFrom'] != NULL) { - $sql .= " and col_time_on >= ?"; - $bindings[]=$postdata['dateFrom'] . ' 00:00:00'; - } - - if ($postdata['dateTo'] != NULL) { - $sql .= " and col_time_on <= ?"; - $bindings[]=$postdata['dateTo'] . ' 23:59:59'; - } - - $sql .= " group by col_dxcc - ) x on dxcc_entities.adif = x.col_dxcc"; - - if ($postdata['includedeleted'] == NULL) { - $sql .= " and dxcc_entities.end is null"; - } - - $sql .= $this->addContinentsToQuery($postdata); - - $query = $this->db->query($sql,$bindings); - - return $query->result(); - } - - function getDxccBandWorked($location_list, $band, $postdata) { - $bindings=[]; - $sql = "select adif as dxcc, name from dxcc_entities - join ( - select col_dxcc from ".$this->config->item('table_name')." thcv - LEFT JOIN satellite on thcv.COL_SAT_NAME = satellite.name - where station_id in (" . $location_list . - ") and col_dxcc > 0"; - $sql .= $this->genfunctions->addBandToQuery($band,$bindings); - if ($band == 'SAT') { - $sql .= " and col_prop_mode ='SAT'"; - if ($postdata['sat'] != 'All') { - $sql .= " and col_sat_name = ?"; - $bindings[]=$postdata['sat']; - } - } else { - $sql.=" and (col_prop_mode != 'SAT' or col_prop_mode is null)"; - } - - if ($postdata['mode'] != 'All') { - $sql .= " and (col_mode = ? or col_submode = ?)"; - $bindings[]=$postdata['mode']; - $bindings[]=$postdata['mode']; - } - - if ($postdata['dateFrom'] != NULL) { - $sql .= " and col_time_on >= ?"; - $bindings[]=$postdata['dateFrom'] . ' 00:00:00'; - } - - if ($postdata['dateTo'] != NULL) { - $sql .= " and col_time_on <= ?"; - $bindings[]=$postdata['dateTo'] . ' 23:59:59'; - } - - $sql .= $this->addOrbitToQuery($postdata,$bindings); - - $sql .= " group by col_dxcc - ) x on dxcc_entities.adif = x.col_dxcc";; - if ($postdata['includedeleted'] == NULL) { - $sql .= " and dxcc_entities.end is null"; - } - $sql .= $this->addContinentsToQuery($postdata); - - $query = $this->db->query($sql,$bindings); - return $query->result(); - } - - function fetchDxcc($postdata) { - $bindings=[]; - $this->load->model('logbooks_model'); - $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); - - if (!$logbooks_locations_array) { - return null; - } - - $location_list = "'".implode("','",$logbooks_locations_array)."'"; $sql = "select adif, prefix, name, date(end) Enddate, date(start) Startdate, lat, `long` from dxcc_entities"; @@ -565,146 +432,6 @@ class DXCC extends CI_Model { return $query->result(); } - function getDxccWorked($location_list, $postdata) { - $bindings=[]; - $sql = "SELECT adif as dxcc FROM dxcc_entities - join ( - select col_dxcc - from ".$this->config->item('table_name')." thcv - LEFT JOIN satellite on thcv.COL_SAT_NAME = satellite.name - where station_id in (" . $location_list . - ") and col_dxcc > 0"; - $sql .= $this->genfunctions->addBandToQuery($postdata['band'],$bindings); - if ($postdata['band'] == 'SAT') { - $sql .= " and col_prop_mode = 'SAT'"; - if ($postdata['sat'] != 'All') { - $sql .= " and col_sat_name = ?"; - $bindings[]=$postdata['sat']; - } - $sql .= $this->addOrbitToQuery($postdata,$bindings); - } else { - $sql.=" and (col_prop_mode != 'SAT' or col_prop_mode is null)"; - } - - - if ($postdata['mode'] != 'All') { - $sql .= " and (col_mode = ? or col_submode = ?)"; - $bindings[]=$postdata['mode']; - $bindings[]=$postdata['mode']; - } - - if ($postdata['dateFrom'] != NULL) { - $sql .= " and col_time_on >= ?"; - $bindings[]=$postdata['dateFrom'] . ' 00:00:00'; - } - - if ($postdata['dateTo'] != NULL) { - $sql .= " and col_time_on <= ?"; - $bindings[]=$postdata['dateTo'] . ' 23:59:59'; - } - - $sql .= " and not exists (select 1 from ".$this->config->item('table_name')." where station_id in (". $location_list .") and col_dxcc = thcv.col_dxcc and col_dxcc > 0"; - $sql .= $this->genfunctions->addBandToQuery($postdata['band'],$bindings); - if ($postdata['band'] == 'SAT') { - $sql .= " and col_prop_mode = 'SAT'"; - if ($postdata['sat'] != 'All') { - $sql .= " and col_sat_name = ?"; - $bindings[]=$postdata['sat']; - } - $sql .= $this->addOrbitToQuery($postdata,$bindings); - } else { - $sql.=" and (col_prop_mode != 'SAT' or col_prop_mode is null)"; - } - - if ($postdata['dateFrom'] != NULL) { - $sql .= " and col_time_on >= ?"; - $bindings[]=$postdata['dateFrom'] . ' 00:00:00'; - } - - if ($postdata['dateTo'] != NULL) { - $sql .= " and col_time_on <= ?"; - $bindings[]=$postdata['dateTo'] . ' 23:59:59'; - } - - - if ($postdata['mode'] != 'All') { - $sql .= " and (col_mode = ? or col_submode = ?)"; - $bindings[]=$postdata['mode']; - $bindings[]=$postdata['mode']; - } - - $sql .= $this->genfunctions->addQslToQuery($postdata); - $sql .= ')'; - $sql .= " group by col_dxcc - ) ll on dxcc_entities.adif = ll.col_dxcc - where 1=1"; - - if ($postdata['includedeleted'] == NULL) { - $sql .= " and dxcc_entities.end is null"; - } - - $sql .= $this->addContinentsToQuery($postdata); - $query = $this->db->query($sql,$bindings); - return $query->result(); - } - - function getDxccConfirmed($location_list, $postdata) { - $bindings=[]; - $sql = "SELECT adif as dxcc, lotw, qsl, eqsl, qrz, clublog FROM dxcc_entities - join ( - select col_dxcc, sum(case when thcv.col_lotw_qsl_rcvd ='Y' then 1 else 0 end) as lotw,sum(case when thcv.col_qsl_rcvd = 'Y' then 1 else 0 end) as qsl,sum(case when thcv.col_eqsl_qsl_rcvd = 'Y' then 1 else 0 end) as eqsl,sum(case when thcv.COL_QRZCOM_QSO_DOWNLOAD_STATUS= 'Y' then 1 else 0 end) as qrz,sum(case when thcv.COL_CLUBLOG_QSO_DOWNLOAD_STATUS = 'Y' then 1 else 0 end) as clublog - from ".$this->config->item('table_name')." thcv - LEFT JOIN satellite on thcv.COL_SAT_NAME = satellite.name - where station_id in (". $location_list . - ") and col_dxcc > 0"; - - if ($postdata['dateFrom'] != NULL) { - $sql .= " and col_time_on >= ?"; - $bindings[]=$postdata['dateFrom'] . ' 00:00:00'; - } - - if ($postdata['dateTo'] != NULL) { - $sql .= " and col_time_on <= ?"; - $bindings[]=$postdata['dateTo'] . ' 23:59:59'; - } - - $sql .= $this->genfunctions->addBandToQuery($postdata['band'],$bindings); - if ($postdata['band'] == 'SAT') { - $sql .= " and col_prop_mode = 'SAT'"; - if ($postdata['sat'] != 'All') { - $sql .= " and col_sat_name = ?"; - $bindings[]=$postdata['sat']; - } - } else { - $sql.=" and (col_prop_mode != 'SAT' or col_prop_mode is null)"; - } - - if ($postdata['mode'] != 'All') { - $sql .= " and (col_mode = ? or col_submode = ?)"; - $bindings[]=$postdata['mode']; - $bindings[]=$postdata['mode']; - } - - $sql .= $this->addOrbitToQuery($postdata,$bindings); - - $sql .= $this->genfunctions->addQslToQuery($postdata); - - $sql .= " group by col_dxcc - ) ll on dxcc_entities.adif = ll.col_dxcc - where 1=1"; - - if ($postdata['includedeleted'] == NULL) { - $sql .= " and dxcc_entities.end is null"; - } - - $sql .= $this->addContinentsToQuery($postdata); - - - $query = $this->db->query($sql,$bindings); - - return $query->result(); - } - // Made function instead of repeating this several times function addContinentsToQuery($postdata) { $sql = ''; @@ -738,100 +465,6 @@ class DXCC extends CI_Model { return $sql; } - /* - * Function gets worked and confirmed summary on each band on the active stationprofile - * Now uses data from get_dxcc_array instead of separate queries - much more efficient! - */ - function get_dxcc_summary($bands, $postdata) { - $this->load->model('logbooks_model'); - $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); - - if (!$logbooks_locations_array) { - return null; - } - - $location_list = "'".implode("','",$logbooks_locations_array)."'"; - - // Get all DXCC entities - $this->load->model('dxcc'); - $dxccEntities = $this->dxcc->list_current(); - - $result = $this->get_dxcc_array($dxccEntities, $bands, $postdata); - - if ($result && isset($result['summary'])) { - return $result['summary']; - } - - // Fallback to empty structure if something went wrong - $dxccSummary = []; - foreach ($bands as $band) { - $dxccSummary['worked'][$band] = '-'; - $dxccSummary['confirmed'][$band] = '-'; - } - $dxccSummary['worked']['Total'] = '-'; - $dxccSummary['confirmed']['Total'] = '-'; - - return $dxccSummary; - } - - function getSummaryByBand($band, $postdata, $location_list) { - $bindings=[]; - $sql = "SELECT count(distinct thcv.col_dxcc) as count FROM " . $this->config->item('table_name') . " thcv"; - $sql .= " LEFT JOIN satellite on thcv.COL_SAT_NAME = satellite.name"; - $sql .= " join dxcc_entities d on thcv.col_dxcc = d.adif"; - - $sql .= " where station_id in (" . $location_list . ") and col_dxcc > 0"; - - if ($band == 'SAT') { - $sql .= " and thcv.col_prop_mode ='" . $band . "'"; - if ($band != 'All' && $postdata['sat'] != 'All') { - $sql .= " and col_sat_name = ?"; - $bindings[]=$postdata['sat']; - } - } else if ($band == 'All') { - $this->load->model('bands'); - - $bandslots = $this->bands->get_worked_bands('dxcc'); - - $bandslots_list = "'".implode("','",$bandslots)."'"; - - $sql .= " and thcv.col_band in (" . $bandslots_list . ")" . - " and thcv.col_prop_mode !='SAT'"; - } else { - $sql .= " and thcv.col_prop_mode !='SAT'"; - $sql .= " and thcv.col_band = ?"; - $bindings[]=$band; - } - - if ($postdata['dateFrom'] != NULL) { - $sql .= " and col_time_on >= ?"; - $bindings[]=$postdata['dateFrom'] . ' 00:00:00'; - } - - if ($postdata['dateTo'] != NULL) { - $sql .= " and col_time_on <= ?"; - $bindings[]=$postdata['dateTo'] . ' 23:59:59'; - } - - if ($postdata['mode'] != 'All') { - $sql .= " and (col_mode = ? or col_submode = ?)"; - $bindings[]=$postdata['mode']; - $bindings[]=$postdata['mode']; - } - - if ($postdata['includedeleted'] == NULL) { - $sql .= " and d.end is null"; - } - - $sql .= $this->addContinentsToQuery($postdata); - - $sql .= $this->addOrbitToQuery($postdata,$bindings); - - $query = $this->db->query($sql,$bindings); - - return $query->result(); - } - // Adds orbit type to query function addOrbitToQuery($postdata,&$binding) { $sql = ''; @@ -843,68 +476,6 @@ class DXCC extends CI_Model { return $sql; } - function getSummaryByBandConfirmed($band, $postdata, $location_list) { - $bindings=[]; - $sql = "SELECT count(distinct thcv.col_dxcc) as count, sum(case when thcv.col_lotw_qsl_rcvd ='Y' then 1 else 0 end) as lotw,sum(case when thcv.col_qsl_rcvd = 'Y' then 1 else 0 end) as qsl,sum(case when thcv.col_eqsl_qsl_rcvd = 'Y' then 1 else 0 end) as eqsl,sum(case when thcv.COL_QRZCOM_QSO_DOWNLOAD_STATUS= 'Y' then 1 else 0 end) as qrz,sum(case when thcv.COL_CLUBLOG_QSO_DOWNLOAD_STATUS = 'Y' then 1 else 0 end) as clublog FROM " . $this->config->item('table_name') . " thcv"; - $sql .= " LEFT JOIN satellite on thcv.COL_SAT_NAME = satellite.name"; - $sql .= " join dxcc_entities d on thcv.col_dxcc = d.adif"; - - $sql .= " where station_id in (" . $location_list . ") and col_dxcc > 0"; - - if ($band == 'SAT') { - $sql .= " and thcv.col_prop_mode = ?"; - $bindings[]=$band; - if ($postdata['sat'] != 'All') { - $sql .= " and col_sat_name = ?"; - $bindings[]=$postdata['sat']; - } - } else if ($band == 'All') { - $this->load->model('bands'); - - $bandslots = $this->bands->get_worked_bands('dxcc'); - - $bandslots_list = "'".implode("','",$bandslots)."'"; - - $sql .= " and thcv.col_band in (" . $bandslots_list . ")" . - " and thcv.col_prop_mode !='SAT'"; - } else { - $sql .= " and thcv.col_prop_mode !='SAT'"; - $sql .= " and thcv.col_band = ?"; - $bindings[]=$band; - } - - if ($postdata['dateFrom'] != NULL) { - $sql .= " and col_time_on >= ?"; - $bindings[]=$postdata['dateFrom'] . ' 00:00:00'; - } - - if ($postdata['dateTo'] != NULL) { - $sql .= " and col_time_on <= ?"; - $bindings[]=$postdata['dateTo'] . ' 23:59:59'; - } - - if ($postdata['mode'] != 'All') { - $sql .= " and (col_mode = ? or col_submode = ?)"; - $bindings[]=$postdata['mode']; - $bindings[]=$postdata['mode']; - } - - $sql .= $this->genfunctions->addQslToQuery($postdata); - - $sql .= $this->addOrbitToQuery($postdata,$bindings); - - - if ($postdata['includedeleted'] == NULL) { - $sql .= " and d.end is null"; - } - - $sql .= $this->addContinentsToQuery($postdata); - - $query = $this->db->query($sql,$bindings); - - return $query->result(); - } - /* * Functions below are all used in the calltester controller */ @@ -1226,10 +797,8 @@ class DXCC extends CI_Model { // query the table, removing a character from the right until a match for ($i = $len; $i > 0; $i--) { - //printf("searching for %s\n", substr($call, 0, $i)); if (array_key_exists(substr($call, 0, $i), $dxcc_array)) { $row = $dxcc_array[substr($call, 0, $i)]; - // $row = $dxcc_result->row_array(); return $row; } } diff --git a/application/views/awards/dxcc/index.php b/application/views/awards/dxcc/index.php index 713b66160..f080aadba 100644 --- a/application/views/awards/dxcc/index.php +++ b/application/views/awards/dxcc/index.php @@ -172,7 +172,7 @@
- + input->post('band') == $band) echo ' selected'; @@ -260,63 +260,60 @@ '.__("(Q)SL-Paper-Card").", "; - echo __("(L)oTW").", "; - echo __("(e)QSL").", "; - echo __('QR(Z)-"confirmation"').", "; - echo __("(C)lublog").", "; - echo __("(W)orked").''; - echo ' + echo __('Legend:'); + echo '
'.__("(Q)SL-Paper-Card").", ";
+		echo __("(L)oTW").", ";
+		echo __("(e)QSL").", ";
+		echo __('QR(Z)-"confirmation"').", ";
+		echo __("(C)lublog").", ";
+		echo __("(W)orked").'
'; + echo ' - - + + '; - foreach($bands as $band) { - echo ''; - } - echo ' - - '; + foreach($bands as $band) { + if (($posted_band != 'SAT') && ($band == 'SAT')) { + continue; + } + echo ''; + } + echo ' + + '; foreach ($dxcc_array as $dxcc => $value) { // Fills the table with the data - echo ' - '; - foreach ($value as $name => $key) { - if (isset($value['Deleted']) && $value['Deleted'] == 1 && $name == "name") { - echo ''; - } else if ($name == "Deleted") { - continue; - } else { - echo ''; - } - } - echo ''; - } - echo '
# ' . __("DXCC Name") . ' ' . __("Prefix") . '' . $band . '
' . $band . '
'. $i++ .'' . $key . ' '.__("Deleted DXCC").'' . $key . '
-

' . __("Summary") . '

+ echo ' + '. $i++ .''; + foreach ($value as $name => $key) { + if (isset($value['Deleted']) && $value['Deleted'] == 1 && $name == "name") { + echo '' . $key . ' '.__("Deleted DXCC").''; + } else if ($name == "Deleted") { + continue; + } else { + echo '' . $key . ''; + } + } + echo ''; + } + echo ' +

' . __("Summary") . '

- - - '; +
+ + '; - $addsat=''; - foreach($bands as $band) { - if ($band != 'SAT') { - echo ''; - } else { - $addsat=''; - } - } - if ($posted_band != 'SAT') { - echo ''; + foreach($bands as $band) { + if (($posted_band != 'SAT') && ($band == 'SAT')) { + continue; } - if (count($bands) > 1) { - echo ''; - } - echo $addsat; - echo ' + echo ''; + } + if ($posted_band != 'SAT') { + echo ''; + } + echo ' @@ -324,55 +321,43 @@ '; $addsat=''; foreach ($dxcc_summary['worked'] as $band => $dxcc) { // Fills the table with the data - if ($posted_band == 'SAT' && $band == 'Total') { + if (($posted_band != 'SAT') && ($band == 'SAT')) { continue; } - if ($band != 'SAT') { - echo ''; - } else { - $addsat=''; + + if (($posted_band == 'SAT') && ($band == 'Total')) { + continue; } - } - if (count($bands) > 1) { - echo ''; - } - - if ($addsat != '' && count($dxcc_summary['worked']) > 1) { - echo $addsat; + echo ''; } echo ''; $addsat=''; foreach ($dxcc_summary['confirmed'] as $band => $dxcc) { // Fills the table with the data - if ($posted_band == 'SAT' && $band == 'Total') { + if (($posted_band != 'SAT') && ($band == 'SAT')) { continue; } - if ($band != 'SAT') { - echo ''; - } else { - $addsat=''; - } - } - if (count($bands) > 1) { - echo ''; - } - if ($addsat != '' && count($dxcc_summary['confirmed']) > 1) { - echo $addsat; + if (($posted_band == 'SAT') && ($band == 'Total')) { + continue; + } + + echo ''; + } echo ' @@ -380,7 +365,7 @@ '; } else { - echo ''; + echo ''; } ?> From 4ee88dc8d372948a0b5a623ed51b965a5a2a9899 Mon Sep 17 00:00:00 2001 From: phl0 Date: Tue, 3 Mar 2026 08:16:11 +0100 Subject: [PATCH 09/13] Fix "all ex. SAT" map --- application/models/Dxcc.php | 114 ++++++++++++++++++------------------ 1 file changed, 58 insertions(+), 56 deletions(-) diff --git a/application/models/Dxcc.php b/application/models/Dxcc.php index eb6063301..3ef9b3f3c 100644 --- a/application/models/Dxcc.php +++ b/application/models/Dxcc.php @@ -142,65 +142,67 @@ class DXCC extends CI_Model { } } - foreach ($dxccDataSat as $dxcc) { - if (($postdata['band'] != 'SAT') && ($band == 'SAT')) { - continue; - } - // Skip if this band is not in our requested bands list - if (!isset($validBands[$dxcc->col_band])) { - continue; - } - - // Ensure string key for consistency - $dxccKey = (string)$dxcc->dxcc; - - // Track worked status for this DXCC - if (!isset($dxccWorkedStatus[$dxccKey])) { - $dxccWorkedStatus[$dxccKey] = 0; - } - $dxccWorkedStatus[$dxccKey]++; - - // Check if confirmed based on the confirmation types selected in postdata - $isConfirmed = false; - $confirmationLetters = ''; - if (isset($postdata['qsl']) && $postdata['qsl'] == 1 && $dxcc->qsl > 0) { - $isConfirmed = true; - $confirmationLetters .= 'Q'; - } - if (isset($postdata['lotw']) && $postdata['lotw'] == 1 && $dxcc->lotw > 0) { - $isConfirmed = true; - $confirmationLetters .= 'L'; - } - if (isset($postdata['eqsl']) && $postdata['eqsl'] == 1 && $dxcc->eqsl > 0) { - $isConfirmed = true; - $confirmationLetters .= 'E'; - } - if (isset($postdata['qrz']) && $postdata['qrz'] == 1 && $dxcc->qrz > 0) { - $isConfirmed = true; - $confirmationLetters .= 'Z'; - } - if (isset($postdata['clublog']) && $postdata['clublog'] == 1 && $dxcc->clublog > 0) { - $isConfirmed = true; - $confirmationLetters .= 'C'; - } - - if ($isConfirmed) { - $dxccMatrix[$dxccKey][$dxcc->col_band] = ''; - // Track confirmed DXCCs for summary - if (!isset($confirmedDxccs[$dxcc->col_band][$dxccKey])) { - $confirmedDxccs[$dxcc->col_band][$dxccKey] = true; - $summary['confirmed'][$dxcc->col_band]++; + if ($postdata['band'] == 'SAT') { + foreach ($dxccDataSat as $dxcc) { + if (($postdata['band'] != 'SAT') && ($band == 'SAT')) { + continue; } - } else { - if ($postdata['worked'] != NULL) { - $dxccMatrix[$dxccKey][$dxcc->col_band] = ''; + // Skip if this band is not in our requested bands list + if (!isset($validBands[$dxcc->col_band])) { + continue; } - } - // Track worked DXCCs for summary - if (!isset($workedDxccs[$dxcc->col_band][$dxccKey])) { - $workedDxccs[$dxcc->col_band][$dxccKey] = true; - $summary['worked'][$dxcc->col_band]++; + // Ensure string key for consistency + $dxccKey = (string)$dxcc->dxcc; + + // Track worked status for this DXCC + if (!isset($dxccWorkedStatus[$dxccKey])) { + $dxccWorkedStatus[$dxccKey] = 0; + } + $dxccWorkedStatus[$dxccKey]++; + + // Check if confirmed based on the confirmation types selected in postdata + $isConfirmed = false; + $confirmationLetters = ''; + if (isset($postdata['qsl']) && $postdata['qsl'] == 1 && $dxcc->qsl > 0) { + $isConfirmed = true; + $confirmationLetters .= 'Q'; + } + if (isset($postdata['lotw']) && $postdata['lotw'] == 1 && $dxcc->lotw > 0) { + $isConfirmed = true; + $confirmationLetters .= 'L'; + } + if (isset($postdata['eqsl']) && $postdata['eqsl'] == 1 && $dxcc->eqsl > 0) { + $isConfirmed = true; + $confirmationLetters .= 'E'; + } + if (isset($postdata['qrz']) && $postdata['qrz'] == 1 && $dxcc->qrz > 0) { + $isConfirmed = true; + $confirmationLetters .= 'Z'; + } + if (isset($postdata['clublog']) && $postdata['clublog'] == 1 && $dxcc->clublog > 0) { + $isConfirmed = true; + $confirmationLetters .= 'C'; + } + + if ($isConfirmed) { + $dxccMatrix[$dxccKey][$dxcc->col_band] = ''; + // Track confirmed DXCCs for summary + if (!isset($confirmedDxccs[$dxcc->col_band][$dxccKey])) { + $confirmedDxccs[$dxcc->col_band][$dxccKey] = true; + $summary['confirmed'][$dxcc->col_band]++; + } + } else { + if ($postdata['worked'] != NULL) { + $dxccMatrix[$dxccKey][$dxcc->col_band] = ''; + } + } + + // Track worked DXCCs for summary + if (!isset($workedDxccs[$dxcc->col_band][$dxccKey])) { + $workedDxccs[$dxcc->col_band][$dxccKey] = true; + $summary['worked'][$dxcc->col_band]++; + } } } From 0865910e982b6c67c0d6fcc3d02d61dfa5c7d179 Mon Sep 17 00:00:00 2001 From: phl0 Date: Tue, 3 Mar 2026 08:31:48 +0100 Subject: [PATCH 10/13] Fix map re non-SAT QSOs --- application/models/Logbook_model.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index 6452f315c..9232e3c22 100644 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -487,6 +487,8 @@ class Logbook_model extends CI_Model { if ($orbit != 'All' && $orbit != null) { $this->db->where("satellite.orbit", $orbit); } + } else { + $this->db->where("COL_PROP_MODE !=", "SAT"); } break; case 'IOTA': From 5e2b822ff03d186aeec8029b730c3ccccf7a826e Mon Sep 17 00:00:00 2001 From: phl0 Date: Tue, 3 Mar 2026 12:52:41 +0100 Subject: [PATCH 11/13] Fix wording for QSO details list --- application/controllers/Awards.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/application/controllers/Awards.php b/application/controllers/Awards.php index 79339c37f..7f96d1bd0 100644 --- a/application/controllers/Awards.php +++ b/application/controllers/Awards.php @@ -574,7 +574,8 @@ class Awards extends CI_Controller { // Render Page $data['page_title'] = __("Log View")." - " . $type; - $data['filter'] = (($type != $band) ? $type : '')." ".$searchphrase.__(" and band ").$band; + $data['filter'] = (($type != $band) ? $type : '')." ".$searchphrase." ".__("and")." "; + $data['filter'] .= ($band == 'All' ? __("Every band (w/o SAT)") : __("band")." ".$band); if ($band == 'SAT') { if ($sat != 'All' && $sat != null) { $data['filter'] .= __(" and satellite ").$sat; From 5898c26a3b107f329a33a00283837290565f3c60 Mon Sep 17 00:00:00 2001 From: phl0 Date: Tue, 3 Mar 2026 12:56:23 +0100 Subject: [PATCH 12/13] Lower first char --- application/controllers/Awards.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/controllers/Awards.php b/application/controllers/Awards.php index 7f96d1bd0..4712c64ba 100644 --- a/application/controllers/Awards.php +++ b/application/controllers/Awards.php @@ -575,7 +575,7 @@ class Awards extends CI_Controller { // Render Page $data['page_title'] = __("Log View")." - " . $type; $data['filter'] = (($type != $band) ? $type : '')." ".$searchphrase." ".__("and")." "; - $data['filter'] .= ($band == 'All' ? __("Every band (w/o SAT)") : __("band")." ".$band); + $data['filter'] .= ($band == 'All' ? lcfirst(__("Every band (w/o SAT)")) : __("band")." ".$band); if ($band == 'SAT') { if ($sat != 'All' && $sat != null) { $data['filter'] .= __(" and satellite ").$sat; From 5d428c6ec212fcd34760e2c556d77d34bbf07c2e Mon Sep 17 00:00:00 2001 From: phl0 Date: Tue, 3 Mar 2026 13:35:58 +0100 Subject: [PATCH 13/13] Fix wording in legend headline --- application/views/awards/dxcc/index.php | 1 + assets/js/sections/dxccmap.js | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/application/views/awards/dxcc/index.php b/application/views/awards/dxcc/index.php index 176c3034d..283f1bd58 100644 --- a/application/views/awards/dxcc/index.php +++ b/application/views/awards/dxcc/index.php @@ -29,6 +29,7 @@ var lang_award_info_ln3 = "" . __("ARRL website") . ""); ?>"; var lang_award_info_ln4 = ""; var lang_award_info_ln5 = ""; + var lang_award_info_all_bands = "";

diff --git a/assets/js/sections/dxccmap.js b/assets/js/sections/dxccmap.js index ca3ad4f7b..40b8c9d03 100644 --- a/assets/js/sections/dxccmap.js +++ b/assets/js/sections/dxccmap.js @@ -158,7 +158,11 @@ function load_dxcc_map2(data, worked, confirmed, notworked) { legend.onAdd = function(map) { var div = L.DomUtil.create("div", "legend"); var band = $('#band2').val(); - div.innerHTML += "

Band: " + band + "

"; + if (band == 'All') { + div.innerHTML += "

" + lang_award_info_all_bands + "

"; + } else { + div.innerHTML += "

Band: " + band + "

"; + } div.innerHTML += '' + lang_general_word_confirmed + ' ('+confirmedcount+')
'; div.innerHTML += '' + lang_general_word_worked_not_confirmed + ' ('+workednotconfirmedcount+')
'; div.innerHTML += '' + lang_general_word_not_worked + ' ('+notworkedcount+')
';
' . $band . '' . $band . '' . __("Total (ex SAT)") . '' . $band . '' . __("Total (ex SAT)") . '
' . __("Total worked") . ''; - if ($band == 'Total') { - echo ''.$dxcc.''; - } else { - echo $dxcc; - } - echo '' . $dxcc . ''; + if ($band == 'Total' && $posted_band != 'SAT') { + echo ''.$dxcc.''; + } else { + echo $dxcc; + } + echo '
' . __("Total confirmed") . ''; - if ($band == 'Total') { - echo ''.$dxcc.''; - } else { - echo $dxcc; - } - echo '' . $dxcc . ''; + if (($posted_band != 'SAT') && ($band == 'Total')) { + echo ''.$dxcc.''; + } else { + echo $dxcc; + } + echo '