Added checks if logbooks exists. Cloudlog would load with an error when starting a new install.

这个提交包含在:
Andreas 2021-11-06 20:53:36 +01:00
父节点 1b2a88b355
当前提交 b8ce4fa33d
共有 2 个文件被更改,包括 123 次插入97 次删除

查看文件

@ -904,6 +904,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 ($logbooks_locations_array) {
//$this->db->select('COL_CALL, COL_BAND, COL_TIME_ON, COL_RST_RCVD, COL_RST_SENT, COL_MODE, COL_SUBMODE, COL_NAME, COL_COUNTRY, COL_PRIMARY_KEY, COL_SAT_NAME, COL_STX_STRING, COL_SRX_STRING, COL_IOTA, COL_STATE, COL_GRIDSQUARE');
$this->db->where_in('station_id', $logbooks_locations_array);
$this->db->order_by("COL_TIME_ON", "desc");
@ -911,6 +912,10 @@ class Logbook_model extends CI_Model {
$query = $this->db->get($this->config->item('table_name'));
return $query;
} else {
return null;
}
}
/* Get all QSOs with a valid grid for use in the KML export */
@ -1003,7 +1008,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 ($logbooks_locations_array) {
$this->db->select('COUNT( * ) as count', FALSE);
$this->db->where_in('station_id', $logbooks_locations_array);
$query = $this->db->get($this->config->item('table_name'));
@ -1015,6 +1020,9 @@ class Logbook_model extends CI_Model {
return $row->count;
}
}
} else {
return null;
}
}
/* Return number of QSOs had today */
@ -1023,7 +1031,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 ($logbooks_locations_array) {
$morning = date('Y-m-d 00:00:00');
$night = date('Y-m-d 23:59:59');
@ -1040,6 +1048,10 @@ class Logbook_model extends CI_Model {
return $row->count;
}
}
} else {
return null;
}
}
/* Return QSOs over a period of days */
@ -1103,6 +1115,8 @@ 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) {
$morning = date('Y-m-01 00:00:00');
$date = new DateTime('now');
@ -1123,6 +1137,9 @@ class Logbook_model extends CI_Model {
return $row->count;
}
}
} else {
return null;
}
}
/* Return QSOs for the year for the active profile */
@ -1146,6 +1163,8 @@ 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) {
$morning = date('Y-01-01 00:00:00');
$night = date('Y-12-31 23:59:59');
@ -1162,6 +1181,9 @@ class Logbook_model extends CI_Model {
return $row->count;
}
}
} else {
return null;
}
}
/* Return total amount of SSB QSOs logged */

查看文件

@ -99,6 +99,7 @@
<?php
$i = 0;
if ($last_five_qsos) {
foreach ($last_five_qsos->result() as $row) { ?>
<?php echo '<tr class="tr'.($i & 1).'">'; ?>
@ -177,7 +178,10 @@
echo '</td>';
?>
</tr>
<?php $i++; } ?>
<?php $i++; }
}
?>
</table>
</div>
</div>