[Welcome] Might fix bug

这个提交包含在:
Peter Goodhall 2022-10-11 16:54:32 +01:00
父节点 1ff1e541f6
当前提交 c08257beaa
共有 3 个文件被更改,包括 7 次插入7 次删除

查看文件

@ -18,7 +18,7 @@ class Welcome extends CI_Controller {
// load stations model // load stations model
$this->load->model('stations'); $this->load->model('stations');
$data['CountAllStationLocations'] = $this->stations->CountAllStationLocations(); $data['CountAllStationLocations'] = $this->stations->CountAllStationLocations();
// load logbooks model // load logbooks model
$this->load->model('logbooks_model'); $this->load->model('logbooks_model');
$data['NumberOfStationLogbooks'] = $this->logbooks_model->CountAllStationLogbooks(); $data['NumberOfStationLogbooks'] = $this->logbooks_model->CountAllStationLogbooks();
@ -26,11 +26,10 @@ class Welcome extends CI_Controller {
// load api model // load api model
$this->load->model('api_model'); $this->load->model('api_model');
$data['NumberOfAPIKeys'] = $this->api_model->CountKeysWithNoUserID(); $data['NumberOfAPIKeys'] = $this->api_model->CountKeysWithNoUserID();
// load note model // load note model
$this->load->model('note'); $this->load->model('note');
$data['NumberOfNotes'] = $this->note->CountAllNotes(); $data['NumberOfNotes'] = $this->note->CountAllNotes();
if($data['CountAllStationLocations'] == 0 || $data['NumberOfStationLogbooks'] == 0 || $data['NumberOfAPIKeys'] > 0 || $data['NumberOfNotes'] > 0) { if($data['CountAllStationLocations'] == 0 || $data['NumberOfStationLogbooks'] == 0 || $data['NumberOfAPIKeys'] > 0 || $data['NumberOfNotes'] > 0) {
// load views // load views

查看文件

@ -9,7 +9,9 @@ class Logbooks_model extends CI_Model {
function CountAllStationLogbooks() { function CountAllStationLogbooks() {
// count all logbooks // 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() { function add() {

查看文件

@ -157,10 +157,9 @@ class Stations extends CI_Model {
} }
function CountAllStationLocations() { function CountAllStationLocations() {
// count all logbooks
// where user_id is not NULL
$this->db->where('user_id !=', 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) { function set_active($current, $new) {