From af1451b5421141ea3c43f11a52034301f129d021 Mon Sep 17 00:00:00 2001 From: phl0 Date: Wed, 16 Feb 2022 08:29:03 +0100 Subject: [PATCH] Limit results to 500 and get rid of hard coded table name --- application/models/Activated_grids_model.php | 12 ++++++------ application/models/Logbook_model.php | 1 + 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/application/models/Activated_grids_model.php b/application/models/Activated_grids_model.php index 9ebe502d..c07969ca 100644 --- a/application/models/Activated_grids_model.php +++ b/application/models/Activated_grids_model.php @@ -12,8 +12,8 @@ class Activated_grids_model extends CI_Model { } $sql = 'SELECT DISTINCT station_gridsquare AS SAT_SQUARE, COL_SAT_NAME FROM ' - . 'station_profile JOIN TABLE_HRD_CONTACTS_V01 on TABLE_HRD_CONTACTS_V01.station_id = station_profile.station_id ' - . 'WHERE station_profile.station_gridsquare != "" AND TABLE_HRD_CONTACTS_V01.COL_SAT_NAME != ""'; + . 'station_profile JOIN '.$this->config->item('table_name').' on '.$this->config->item('table_name').'.station_id = station_profile.station_id ' + . 'WHERE station_profile.station_gridsquare != "" AND '.$this->config->item('table_name').'.COL_SAT_NAME != ""'; return $this->db->query($sql); } @@ -30,8 +30,8 @@ class Activated_grids_model extends CI_Model { $location_list = "'".implode("','",$logbooks_locations_array)."'"; $sql = 'SELECT DISTINCT station_gridsquare AS SAT_SQUARE, COL_SAT_NAME FROM ' - . 'station_profile JOIN TABLE_HRD_CONTACTS_V01 on TABLE_HRD_CONTACTS_V01.station_id = station_profile.station_id ' - . 'WHERE station_profile.station_gridsquare != "" AND TABLE_HRD_CONTACTS_V01.COL_SAT_NAME != "" ' + . 'station_profile JOIN '.$this->config->item('table_name').' on '.$this->config->item('table_name').'.station_id = station_profile.station_id ' + . 'WHERE station_profile.station_gridsquare != "" AND '.$this->config->item('table_name').'.COL_SAT_NAME != "" ' . 'AND (COL_LOTW_QSL_SENT = "Y" OR COL_QSL_SENT = "Y");'; return $this->db->query($sql); @@ -49,7 +49,7 @@ class Activated_grids_model extends CI_Model { $location_list = "'".implode("','",$logbooks_locations_array)."'"; $sql = 'SELECT DISTINCT station_gridsquare AS GRID_SQUARES, COL_BAND FROM ' - . 'station_profile JOIN TABLE_HRD_CONTACTS_V01 on TABLE_HRD_CONTACTS_V01.station_id = station_profile.station_id ' + . 'station_profile JOIN '.$this->config->item('table_name').' on '.$this->config->item('table_name').'.station_id = station_profile.station_id ' . 'WHERE station_profile.station_gridsquare != "" '; if ($band != 'All') { @@ -76,7 +76,7 @@ class Activated_grids_model extends CI_Model { $location_list = "'".implode("','",$logbooks_locations_array)."'"; $sql = 'SELECT DISTINCT station_gridsquare AS GRID_SQUARES, COL_BAND FROM ' - . 'station_profile JOIN TABLE_HRD_CONTACTS_V01 on TABLE_HRD_CONTACTS_V01.station_id = station_profile.station_id ' + . 'station_profile JOIN '.$this->config->item('table_name').' on '.$this->config->item('table_name').'.station_id = station_profile.station_id ' . 'WHERE station_profile.station_gridsquare != "" '; if ($band != 'All') { diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index ef92267e..a4731762 100755 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -306,6 +306,7 @@ class Logbook_model extends CI_Model { $this->db->where("(COL_MODE='" . $mode . "' OR COL_SUBMODE='" . $mode ."')"); } $this->db->order_by("COL_TIME_ON", "desc"); + $this->db->limit(500); return $this->db->get($this->config->item('table_name')); }