From 8ef96a5318ef95059678dad04493cb3c0d088629 Mon Sep 17 00:00:00 2001 From: Andreas Kristiansen <6977712+AndreasK79@users.noreply.github.com> Date: Tue, 27 May 2025 07:54:42 +0200 Subject: [PATCH] Added mode in the result table --- application/models/Stats.php | 34 +++++++++++++++++++ .../views/statistics/initialresult.php | 6 ++-- 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/application/models/Stats.php b/application/models/Stats.php index 3797400f4..e04fb1aba 100644 --- a/application/models/Stats.php +++ b/application/models/Stats.php @@ -929,6 +929,40 @@ return null; } + $sql = "select thcv.col_call, thcv.col_time_on, thcv.col_band, thcv.col_mode, thcv.col_submode, thcv.col_primary_key FROM ". $this->config->item('table_name') . " thcv"; + + $sql .= " join (SELECT col_call, min(col_time_on) firstworked, col_band, min(col_primary_key) qsoid FROM ".$this->config->item('table_name'); + + $sql .= " where station_id in (" . implode(',',$logbooks_locations_array) . ") and col_prop_mode ='EME'"; + + if ($mode != 'All') { + $sql .= " and (col_mode = ? or col_submode = ?)"; + $binding[] = $mode; + $binding[] = $mode; + } + + if ($band != 'All') { + $sql .= " and col_band = ?"; + $binding[] = $band; + } + + $sql .= " group by col_call, col_band order by firstworked) x on thcv.col_primary_key = x.qsoid"; + + $result = $this->db->query($sql, $binding); + + return $result->result(); + } + + public function getInitialsFromDb2($band, $mode) { + $binding = []; + + $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; + } + $sql = "SELECT col_call, min(col_time_on) firstworked, col_band, min(col_primary_key) qsoid FROM ".$this->config->item('table_name'); $sql .= " where station_id in (" . implode(',',$logbooks_locations_array) . ") and col_prop_mode ='EME'"; diff --git a/application/views/statistics/initialresult.php b/application/views/statistics/initialresult.php index 76e2ba55c..1f9118d41 100644 --- a/application/views/statistics/initialresult.php +++ b/application/views/statistics/initialresult.php @@ -22,14 +22,14 @@ if ($intials_array) { '; $i = 1; foreach ($intials_array as $line) { - $date_as_timestamp = strtotime($line->firstworked ?? '1970-01-01 00:00:00'); + $date_as_timestamp = strtotime($line->col_time_on ?? '1970-01-01 00:00:00'); echo ' ' . $i++ . ' ' . date($custom_date_format, $date_as_timestamp) . ' ' . $line->col_call . ' ' . $line->col_band . ' - - qsoid . ')>' . __("Show") . ' + ' . ($line->col_submode ?? $line->col_mode) . ' + col_primary_key . ')>' . __("Show") . ' '; }