Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Order by primary key as second criterion #1954

Merged
merged 1 commit into from
Jan 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion application/models/Logbook_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -1113,6 +1113,7 @@ function get_qsos($num, $offset, $StationLocationsArray = null) {
$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);
Expand Down Expand Up @@ -1179,7 +1180,7 @@ function get_last_qsos($num, $StationLocationsArray = null) {

$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
Expand Down
4 changes: 2 additions & 2 deletions application/models/Logbookadvanced_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public function searchQsos($searchCriteria) : array {
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
";

Expand Down Expand Up @@ -217,4 +217,4 @@ function get_modes() {

return $modes;
}
}
}