[Dashboard] Fixes errors on clean install where variables have no numbers on the dashboard counts

这个提交包含在:
Peter Goodhall 2021-11-14 13:10:18 +00:00
父节点 914333693c
当前提交 08af5c3843

查看文件

@ -1323,6 +1323,7 @@ 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(!empty($logbooks_locations_array)) {
$this->db->select('count(COL_QSL_SENT) AS count');
$this->db->where_in('station_id', $logbooks_locations_array);
$this->db->where('COL_QSL_SENT =', 'Y');
@ -1336,6 +1337,9 @@ class Logbook_model extends CI_Model {
} else {
return $row->count;
}
} else {
return 0;
}
}
/* Return total number of QSL Cards requested for printing - that means "requested" or "queued" */
@ -1344,6 +1348,7 @@ 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(!empty($logbooks_locations_array)) {
$this->db->select('count(COL_QSL_SENT) AS count');
$this->db->where_in('station_id', $logbooks_locations_array);
$this->db->where_in('COL_QSL_SENT', array('Q', 'R'));
@ -1357,6 +1362,9 @@ class Logbook_model extends CI_Model {
} else {
return $row->count;
}
} else {
return 0;
}
}
/* Return total number of QSL Cards received */
@ -1365,6 +1373,7 @@ 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(!empty($logbooks_locations_array)) {
$this->db->select('count(COL_QSL_RCVD) AS count');
$this->db->where_in('station_id', $logbooks_locations_array);
$this->db->where('COL_QSL_RCVD =', 'Y');
@ -1378,6 +1387,9 @@ class Logbook_model extends CI_Model {
} else {
return $row->count;
}
} else {
return 0;
}
}
/* Return total number of countries worked */
@ -1386,6 +1398,7 @@ 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(!empty($logbooks_locations_array)) {
$this->db->select('DISTINCT (COL_COUNTRY)');
$this->db->where_in('station_id', $logbooks_locations_array);
$this->db->where('COL_COUNTRY !=', 'Invalid');
@ -1393,6 +1406,9 @@ class Logbook_model extends CI_Model {
$query = $this->db->get($this->config->item('table_name'));
return $query->num_rows();
} else {
return 0;
}
}
/* Return total number of countries worked */
@ -1401,6 +1417,7 @@ 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(!empty($logbooks_locations_array)) {
$this->db->select('DISTINCT ('.$this->config->item('table_name').'.COL_COUNTRY)');
$this->db->join('dxcc_entities', 'dxcc_entities.adif = '.$this->config->item('table_name').'.col_dxcc');
$this->db->where_in($this->config->item('table_name').'.station_id', $logbooks_locations_array);
@ -1409,6 +1426,9 @@ class Logbook_model extends CI_Model {
$query = $this->db->get($this->config->item('table_name'));
return $query->num_rows();
} else {
return 0;
}
}
/* Return total number of countries confirmed with paper QSL */
@ -1417,6 +1437,7 @@ 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(!empty($logbooks_locations_array)) {
$this->db->select('DISTINCT (COL_COUNTRY)');
$this->db->where_in('station_id', $logbooks_locations_array);
$this->db->where('COL_COUNTRY !=', 'Invalid');
@ -1425,6 +1446,9 @@ class Logbook_model extends CI_Model {
$query = $this->db->get($this->config->item('table_name'));
return $query->num_rows();
} else {
return 0;
}
}
/* Return total number of countries confirmed with eQSL */
@ -1433,6 +1457,7 @@ 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(!empty($logbooks_locations_array)) {
$this->db->select('DISTINCT (COL_COUNTRY)');
$this->db->where_in('station_id', $logbooks_locations_array);
$this->db->where('COL_COUNTRY !=', 'Invalid');
@ -1441,6 +1466,9 @@ class Logbook_model extends CI_Model {
$query = $this->db->get($this->config->item('table_name'));
return $query->num_rows();
} else {
return 0;
}
}
/* Return total number of countries confirmed with LoTW */
@ -1449,6 +1477,7 @@ 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(!empty($logbooks_locations_array)) {
$this->db->select('DISTINCT (COL_COUNTRY)');
$this->db->where_in('station_id', $logbooks_locations_array);
$this->db->where('COL_COUNTRY !=', 'Invalid');
@ -1457,6 +1486,9 @@ class Logbook_model extends CI_Model {
$query = $this->db->get($this->config->item('table_name'));
return $query->num_rows();
} else {
return 0;
}
}
function api_search_query($query) {