From 3fc74975cf26f34791d38def618ca767c4355e2e Mon Sep 17 00:00:00 2001 From: Andreas Kristiansen <6977712+AndreasK79@users.noreply.github.com> Date: Thu, 18 Dec 2025 11:03:06 +0100 Subject: [PATCH 1/8] [Calltester] Added gui for calltester, to see potential wrong DXCC --- application/controllers/Calltester.php | 66 ++++++++++++++++++------- application/views/calltester/index.php | 19 +++++++ application/views/calltester/result.php | 22 +++++++++ assets/js/sections/calltester.js | 15 ++++++ 4 files changed, 105 insertions(+), 17 deletions(-) create mode 100644 application/views/calltester/index.php create mode 100644 application/views/calltester/result.php create mode 100644 assets/js/sections/calltester.js diff --git a/application/controllers/Calltester.php b/application/controllers/Calltester.php index 8da8f79bd..3d3064907 100644 --- a/application/controllers/Calltester.php +++ b/application/controllers/Calltester.php @@ -12,24 +12,39 @@ class Calltester extends CI_Controller { } - public function db() { + public function index() { set_time_limit(3600); // Starting clock time in seconds $start_time = microtime(true); + + $callarray = $this->getQsos(null); + $this->load->model('stations'); + $data['station_profile'] = $this->stations->all_of_user(); + + $footerData = []; + $footerData['scripts'] = [ + 'assets/js/sections/calltester.js?' . filemtime(realpath(__DIR__ . "/../../assets/js/sections/calltester.js")) + ]; + + + $this->load->view('interface_assets/header', $data); + $this->load->view('calltester/index'); + $this->load->view('interface_assets/footer', $footerData); + } + + function doDxccCheck() { $this->load->model('logbook_model'); + $i = 0; + $result = array(); - $sql = 'select distinct col_country, col_call, col_dxcc, date(col_time_on) date from ' . $this->config->item('table_name'); - $query = $this->db->query($sql); + $callarray = $this->getQsos($this->input->post('de', true)); - $callarray = $query->result(); + // Starting clock time in seconds + $start_time = microtime(true); - $result = array(); - - $i = 0; - - foreach ($callarray as $call) { + foreach ($callarray->result() as $call) { $i++; $dxcc = $this->logbook_model->dxcc_lookup($call->col_call, $call->date); @@ -39,8 +54,10 @@ class Calltester extends CI_Controller { if ($call->col_dxcc != $dxcc['adif']) { $result[] = array( 'Callsign' => $call->col_call, - 'Expected country' => $call->col_country, - 'Expected adif' => $call->col_dxcc, + 'QSO date' => $call->date, + 'Station profile' => $call->station_profile_name, + 'Existing DXCC' => $call->col_country, + 'Existing adif' => $call->col_dxcc, 'Result country' => ucwords(strtolower($dxcc['entity']), "- (/"), 'Result adif' => $dxcc['adif'], ); @@ -53,14 +70,29 @@ class Calltester extends CI_Controller { // Calculate script execution time $execution_time = ($end_time - $start_time); - echo " Execution time of script = ".$execution_time." sec
"; - echo $i . " calls tested.
"; - $count = 0; + $data['execution_time'] = $execution_time; + $data['calls_tested'] = $i; + $data['result'] = $result; - if ($result) { - $this->array_to_table($result); - } + $this->load->view('calltester/result', $data); + } + function getQsos($station_id) { + $sql = 'select distinct col_country, col_call, col_dxcc, date(col_time_on) date, station_profile.station_profile_name + from ' . $this->config->item('table_name') . ' + join station_profile on ' . $this->config->item('table_name') . '.station_id = station_profile.station_id + where station_profile.user_id = ?'; + $params[] = array($this->session->userdata('user_id')); + + if ($station_id && is_numeric($station_id)) { + $sql .= ' and ' . $this->config->item('table_name') . '.station_id = ?'; + $params[] = $station_id; + } + $sql .= ' order by station_profile.station_profile_name asc, date desc'; + + $query = $this->db->query($sql, $params); + + return $query; } diff --git a/application/views/calltester/index.php b/application/views/calltester/index.php new file mode 100644 index 000000000..043e76862 --- /dev/null +++ b/application/views/calltester/index.php @@ -0,0 +1,19 @@ +
+
+
+
+ + + +
+
+
+
\ No newline at end of file diff --git a/application/views/calltester/result.php b/application/views/calltester/result.php new file mode 100644 index 000000000..5717709cc --- /dev/null +++ b/application/views/calltester/result.php @@ -0,0 +1,22 @@ + + + + + + + $value) { + echo ""; + } + + // Table body + echo ''; + foreach ($result as $value) { + echo ""; + foreach ($value as $val) { + echo ""; + } + echo ""; + } + echo ''; + echo "
".$key."
".$val."
"; ?> \ No newline at end of file diff --git a/assets/js/sections/calltester.js b/assets/js/sections/calltester.js new file mode 100644 index 000000000..dfc50283e --- /dev/null +++ b/assets/js/sections/calltester.js @@ -0,0 +1,15 @@ + $('#startDxccCheck').on('click', function() { + let de = $('#de').val(); + $('.result').html('
Loading...
'); + $.ajax({ + url: site_url + '/calltester/doDxccCheck', + type: "POST", + data: {de: de}, + success: function(response) { + $('.result').html(response); + }, + error: function(xhr, status, error) { + $('.result').html(''); + } + }); + }); \ No newline at end of file From 79bc7e9734344cbe53f6e0253d669394388cddf8 Mon Sep 17 00:00:00 2001 From: Andreas Kristiansen <6977712+AndreasK79@users.noreply.github.com> Date: Thu, 18 Dec 2025 11:28:58 +0100 Subject: [PATCH 2/8] Minor tweaks --- application/controllers/Calltester.php | 7 ++++--- application/views/calltester/result.php | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/application/controllers/Calltester.php b/application/controllers/Calltester.php index 3d3064907..9224b6465 100644 --- a/application/controllers/Calltester.php +++ b/application/controllers/Calltester.php @@ -60,6 +60,7 @@ class Calltester extends CI_Controller { 'Existing adif' => $call->col_dxcc, 'Result country' => ucwords(strtolower($dxcc['entity']), "- (/"), 'Result adif' => $dxcc['adif'], + 'id' => $call->col_primary_key, ); } } @@ -78,7 +79,7 @@ class Calltester extends CI_Controller { } function getQsos($station_id) { - $sql = 'select distinct col_country, col_call, col_dxcc, date(col_time_on) date, station_profile.station_profile_name + $sql = 'select distinct col_country, col_call, col_dxcc, date(col_time_on) date, station_profile.station_profile_name, col_primary_key from ' . $this->config->item('table_name') . ' join station_profile on ' . $this->config->item('table_name') . '.station_id = station_profile.station_id where station_profile.user_id = ?'; @@ -88,14 +89,14 @@ class Calltester extends CI_Controller { $sql .= ' and ' . $this->config->item('table_name') . '.station_id = ?'; $params[] = $station_id; } - $sql .= ' order by station_profile.station_profile_name asc, date desc'; + + $sql .= ' order by station_profile.station_profile_name asc, date desc'; $query = $this->db->query($sql, $params); return $query; } - function array_to_table($table) { echo '