diff --git a/application/config/migration.php b/application/config/migration.php index 65a4f8e9..ccd36559 100644 --- a/application/config/migration.php +++ b/application/config/migration.php @@ -21,7 +21,7 @@ $config['migration_enabled'] = TRUE; | be upgraded / downgraded to. | */ -$config['migration_version'] = 32; +$config['migration_version'] = 33; /* |-------------------------------------------------------------------------- diff --git a/application/controllers/Station.php b/application/controllers/Station.php index c61a7ad6..826c5c64 100644 --- a/application/controllers/Station.php +++ b/application/controllers/Station.php @@ -20,7 +20,7 @@ class Station extends CI_Controller { $this->load->model('stations'); $this->load->model('Logbook_model'); - $data['stations'] = $this->stations->all(); + $data['stations'] = $this->stations->all_with_count(); $data['current_active'] = $this->stations->find_active(); $data['is_there_qsos_with_no_station_id'] = $this->Logbook_model->check_for_station_id(); diff --git a/application/migrations/033_log_setindex_station_id.php b/application/migrations/033_log_setindex_station_id.php new file mode 100644 index 00000000..d07a1592 --- /dev/null +++ b/application/migrations/033_log_setindex_station_id.php @@ -0,0 +1,18 @@ +db->db_debug = false; + $this->db->query("ALTER TABLE ".$this->config->item('table_name')." ADD INDEX(`station_id`);"); + $this->db->db_debug = true; + } + + public function down() + { + echo "Not possible, sorry."; + } +} \ No newline at end of file diff --git a/application/models/Stations.php b/application/models/Stations.php index bb9bdd1d..a4fdf9f9 100644 --- a/application/models/Stations.php +++ b/application/models/Stations.php @@ -8,7 +8,7 @@ class Stations extends CI_Model { parent::__construct(); } - function all() { + function all_with_count() { $this->db->select('station_profile.*, count('.$this->config->item('table_name').'.station_id) as qso_total'); $this->db->from('station_profile'); @@ -17,6 +17,10 @@ class Stations extends CI_Model { return $this->db->get(); } + function all() { + return $this->db->get('station_profile'); + } + function profile($id) { $this->db->where('station_id', $id); return $this->db->get('station_profile');