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 01/19] [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 @@
+
| ".$key." | "; + } + + // Table body + echo '
|---|
| ".$val." | "; + } + echo "