diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index 3e16345d..75a3cac6 100755 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -991,6 +991,9 @@ class Logbook_model extends CI_Model { $CI->load->model('logbooks_model'); $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + if (!$logbooks_locations_array) { + return null; + } $this->db->select('DATE_FORMAT(COL_TIME_ON, \'%Y\') as \'year\',COUNT(COL_PRIMARY_KEY) as \'total\'', FALSE); $this->db->where_in('station_id', $logbooks_locations_array); @@ -1197,6 +1200,10 @@ class Logbook_model extends CI_Model { $CI->load->model('logbooks_model'); $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + if (!$logbooks_locations_array) { + return null; + } + $this->db->select('COUNT( * ) as count', FALSE); $this->db->where_in('station_id', $logbooks_locations_array); $this->db->where('COL_MODE', 'SSB'); @@ -1221,6 +1228,10 @@ class Logbook_model extends CI_Model { $CI->load->model('logbooks_model'); $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + if (!$logbooks_locations_array) { + return null; + } + $this->db->select('COL_SAT_NAME, COUNT( * ) as count', FALSE); $this->db->where_in('station_id', $logbooks_locations_array); $this->db->where('COL_SAT_NAME !=', 'null'); @@ -1237,6 +1248,10 @@ class Logbook_model extends CI_Model { $CI->load->model('logbooks_model'); $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + if (!$logbooks_locations_array) { + return null; + } + $this->db->select('COUNT( * ) as count', FALSE); $this->db->where_in('station_id', $logbooks_locations_array); $this->db->where('COL_MODE', 'CW'); @@ -1258,6 +1273,10 @@ class Logbook_model extends CI_Model { $CI->load->model('logbooks_model'); $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + if (!$logbooks_locations_array) { + return null; + } + $this->db->select('COUNT( * ) as count', FALSE); $this->db->where_in('station_id', $logbooks_locations_array); $this->db->where('COL_MODE', 'FM'); @@ -1279,6 +1298,10 @@ class Logbook_model extends CI_Model { $CI->load->model('logbooks_model'); $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + if (!$logbooks_locations_array) { + return null; + } + $this->db->select('COUNT( * ) as count', FALSE); $this->db->where_in('station_id', $logbooks_locations_array); $this->db->where('COL_MODE !=', 'SSB'); @@ -1311,6 +1334,10 @@ class Logbook_model extends CI_Model { $CI->load->model('logbooks_model'); $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + if (!$logbooks_locations_array) { + return null; + } + $this->db->select('DISTINCT (COL_BAND) AS band, count( * ) AS count', FALSE); $this->db->where_in('station_id', $logbooks_locations_array); $this->db->group_by('band'); diff --git a/application/views/statistics/index.php b/application/views/statistics/index.php index f3017d5d..4a5c51c8 100644 --- a/application/views/statistics/index.php +++ b/application/views/statistics/index.php @@ -5,9 +5,18 @@ google.load('visualization', '1', {'packages':['corechart']}); // Set a callback to run when the Google Visualization API is loaded. - google.setOnLoadCallback(drawModeChart); - google.setOnLoadCallback(drawBandChart); - google.setOnLoadCallback(drawSatChart); + + google.setOnLoadCallback(drawModeChart); + + + + google.setOnLoadCallback(drawBandChart); + + + + google.setOnLoadCallback(drawSatChart); + + // Callback that creates and populates a data table, // instantiates the pie chart, passes in the data and @@ -19,10 +28,10 @@ data.addColumn('string', 'Topping'); data.addColumn('number', 'Slices'); data.addRows([ - ['SSB', ], - ['CW', ], - ['FM', ], - ['Digi', ], + ['SSB', ], + ['CW', ], + ['FM', ], + ['Digi', ], ]); var color = ifDarkModeThemeReturn('white'); @@ -58,9 +67,15 @@ data.addColumn('string', 'Topping'); data.addColumn('number', 'Slices'); data.addRows([ - result() as $row) { ?> - ['band; ?>', count; ?>], - + result() as $row) { ?> + ['band; ?>', count; ?>], + ]); var color = ifDarkModeThemeReturn('white'); @@ -95,11 +110,14 @@ data.addColumn('string', 'Topping'); data.addColumn('number', 'Slices'); data.addRows([ - result() as $row1) { ?> - COL_SAT_NAME != null) { ?> - ['COL_SAT_NAME; ?>', count; ?>], - - + result() as $row1) { ?> + COL_SAT_NAME != null) { ?> + ['COL_SAT_NAME; ?>', count; ?>], + + ]); var color = ifDarkModeThemeReturn('white'); @@ -128,13 +146,19 @@ }