From d9dd7a882776f5de21f2068a868e7c9a8eb77aa3 Mon Sep 17 00:00:00 2001 From: Andreas Kristiansen <6977712+AndreasK79@users.noreply.github.com> Date: Tue, 14 Oct 2025 18:29:01 +0200 Subject: [PATCH] Fix band logic --- application/controllers/Awards.php | 4 ++-- application/models/Wpx.php | 13 +++++++++---- assets/js/sections/wpx.js | 3 ++- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/application/controllers/Awards.php b/application/controllers/Awards.php index 5c2e83988..0e5b85545 100644 --- a/application/controllers/Awards.php +++ b/application/controllers/Awards.php @@ -2285,8 +2285,7 @@ class Awards extends CI_Controller { $this->load->view('interface_assets/footer', $footerData); } - public function wpx_details() - { + public function wpx_details() { $postdata['band'] = $this->input->post('band', true); $postdata['status'] = $this->input->post('status', true); $postdata['sat'] = $this->security->xss_clean($this->input->post('sats')); @@ -2304,6 +2303,7 @@ class Awards extends CI_Controller { $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['summaryband'] = $this->input->post('summaryband', true); $this->load->model('wpx'); $this->load->model('modes'); diff --git a/application/models/Wpx.php b/application/models/Wpx.php index 2c6922f10..963e3efe1 100644 --- a/application/models/Wpx.php +++ b/application/models/Wpx.php @@ -441,7 +441,12 @@ class WPX extends CI_Model { $bindings[] = $postdata['mode']; $bindings[] = $postdata['mode']; } - $sql .= $this->addBandToQuery($postdata['band'], $bindings); + + if ($postdata['band'] == $postdata['summaryband'] || $postdata['summaryband'] != 'Total') { + $sql .= $this->addBandToQuery($postdata['summaryband'], $bindings); + } else { + $sql .= $this->addBandToQuery($postdata['band'], $bindings); + } if ($postdata['status'] === 'confirmed') { $sql .= $this->addQslToQuery($postdata); @@ -509,18 +514,18 @@ class WPX extends CI_Model { return $sql; } - function addBandToQuery($band,&$binding) { + function addBandToQuery($band, &$binding) { $sql = ''; if ($band == 'SAT') { $sql .= " and col_prop_mode = ?"; - $binding[]=$band; + $binding[] = $band; } else { if ($band == 'All' || $band == 'Total') { $sql .=" and (col_prop_mode!='SAT' or col_prop_mode is null)"; } else { $sql .=" and (col_prop_mode!='SAT' or col_prop_mode is null)"; $sql .= " and col_band = ?"; - $binding[]=$band; + $binding[] = $band; } } diff --git a/assets/js/sections/wpx.js b/assets/js/sections/wpx.js index 62d6bd5e6..da5db319c 100644 --- a/assets/js/sections/wpx.js +++ b/assets/js/sections/wpx.js @@ -14,7 +14,7 @@ function wpxLoadDetails(status, band) { url: site_url + '/awards/wpx_details', type: 'post', data: { - band: band, + band: $('#band2').val(), mode: $('#mode').val(), status: status, sats: $('#sats').val(), @@ -31,6 +31,7 @@ function wpxLoadDetails(status, band) { eqsl: $('#eqsl').is(':checked') ? 1 : 0, qrz: $('#qrz').is(':checked') ? 1 : 0, clublog: $('#clublog').is(':checked') ? 1 : 0, + summaryband: band }, type: 'post', success: function (html) {