From c08257beaa6a6eed363ce87e9b136cedeb3d34c1 Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Tue, 11 Oct 2022 16:54:32 +0100 Subject: [PATCH] [Welcome] Might fix bug --- application/controllers/Welcome.php | 5 ++--- application/models/Logbooks_model.php | 4 +++- application/models/Stations.php | 5 ++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/application/controllers/Welcome.php b/application/controllers/Welcome.php index 303fda78..59ec5176 100644 --- a/application/controllers/Welcome.php +++ b/application/controllers/Welcome.php @@ -18,7 +18,7 @@ class Welcome extends CI_Controller { // load stations model $this->load->model('stations'); $data['CountAllStationLocations'] = $this->stations->CountAllStationLocations(); - + // load logbooks model $this->load->model('logbooks_model'); $data['NumberOfStationLogbooks'] = $this->logbooks_model->CountAllStationLogbooks(); @@ -26,11 +26,10 @@ class Welcome extends CI_Controller { // load api model $this->load->model('api_model'); $data['NumberOfAPIKeys'] = $this->api_model->CountKeysWithNoUserID(); - + // load note model $this->load->model('note'); $data['NumberOfNotes'] = $this->note->CountAllNotes(); - if($data['CountAllStationLocations'] == 0 || $data['NumberOfStationLogbooks'] == 0 || $data['NumberOfAPIKeys'] > 0 || $data['NumberOfNotes'] > 0) { // load views diff --git a/application/models/Logbooks_model.php b/application/models/Logbooks_model.php index c97bb467..f4644342 100644 --- a/application/models/Logbooks_model.php +++ b/application/models/Logbooks_model.php @@ -9,7 +9,9 @@ class Logbooks_model extends CI_Model { function CountAllStationLogbooks() { // count all logbooks - return $this->db->count_all('station_logbooks'); + $this->db->where('user_id !=', NULL); + $query = $this->db->get('station_logbooks'); + return $query->num_rows(); } function add() { diff --git a/application/models/Stations.php b/application/models/Stations.php index b02b5304..9bd40ad6 100644 --- a/application/models/Stations.php +++ b/application/models/Stations.php @@ -157,10 +157,9 @@ class Stations extends CI_Model { } function CountAllStationLocations() { - // count all logbooks - // where user_id is not NULL $this->db->where('user_id !=', NULL); - return $this->db->count_all('station_logbooks'); + $query = $this->db->get('station_profile'); + return $query->num_rows(); } function set_active($current, $new) {