From d10a070ec3777537ef1eb59003586668669b9ac0 Mon Sep 17 00:00:00 2001 From: phl0 Date: Thu, 26 Jan 2023 00:57:38 +0100 Subject: [PATCH 1/2] Order by primary key as second criterion --- application/models/Logbook_model.php | 3 ++- application/models/Logbookadvanced_model.php | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index f188f455..29d14efb 100755 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -1113,6 +1113,7 @@ class Logbook_model extends CI_Model { $this->db->join('station_profile', 'station_profile.station_id = '.$this->config->item('table_name').'.station_id'); $this->db->where_in('station_profile.station_id', $logbooks_locations_array); $this->db->order_by(''.$this->config->item('table_name').'.COL_TIME_ON', "desc"); + $this->db->order_by(''.$this->config->item('table_name').'.COL_PRIMARY_KEY', "desc"); $this->db->limit($num); $this->db->offset($offset); @@ -1179,7 +1180,7 @@ class Logbook_model extends CI_Model { $sql = "SELECT * FROM ( select * from " . $this->config->item('table_name'). " WHERE station_id IN(". $location_list .") - order by col_time_on desc + order by col_time_on desc, col_primary_key desc limit " . $num . ") hrd JOIN station_profile ON station_profile.station_id = hrd.station_id diff --git a/application/models/Logbookadvanced_model.php b/application/models/Logbookadvanced_model.php index f2b3fb31..30be8f8d 100644 --- a/application/models/Logbookadvanced_model.php +++ b/application/models/Logbookadvanced_model.php @@ -91,7 +91,7 @@ class Logbookadvanced_model extends CI_Model { INNER JOIN station_profile ON qsos.station_id=station_profile.station_id WHERE station_profile.user_id = ? $where - ORDER BY qsos.COL_TIME_ON desc + ORDER BY qsos.COL_TIME_ON desc, qsos.COL_PRIMARY_KEY desc LIMIT $limit "; @@ -217,4 +217,4 @@ class Logbookadvanced_model extends CI_Model { return $modes; } -} \ No newline at end of file +} From 348342d752def427de1a32a9ee9bd455099777fd Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Fri, 27 Jan 2023 13:14:23 +0000 Subject: [PATCH 2/2] [Dashboard] Fixes QSOs being out of order --- application/models/Logbook_model.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index 29d14efb..6c7aa411 100755 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -1184,7 +1184,8 @@ class Logbook_model extends CI_Model { limit " . $num . ") hrd JOIN station_profile ON station_profile.station_id = hrd.station_id - LEFT JOIN dxcc_entities ON hrd.col_dxcc = dxcc_entities.adif"; + LEFT JOIN dxcc_entities ON hrd.col_dxcc = dxcc_entities.adif + order by col_time_on desc, col_primary_key desc"; $query = $this->db->query($sql);