Merge pull request #1168 from AndreasK79/days_station_logbooks

[Days With QSOs] Updated code to support station logbooks
这个提交包含在:
Peter Goodhall 2021-09-11 16:54:38 +01:00 提交者 GitHub
当前提交 e78b616946
找不到此签名对应的密钥
GPG 密钥 ID: 4AEE18F83AFDEB23

查看文件

@ -12,12 +12,14 @@ class Dayswithqso_model extends CI_Model
function getDaysWithQso() function getDaysWithQso()
{ {
$CI =& get_instance(); $CI =& get_instance();
$CI->load->model('Stations'); $CI->load->model('logbooks_model');
$station_id = $CI->Stations->find_active(); $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$location_list = "'".implode("','",$logbooks_locations_array)."'";
$sql = "select year(COL_TIME_ON) Year, COUNT(DISTINCT TO_DAYS(COL_TIME_ON)) as Days from " $sql = "select year(COL_TIME_ON) Year, COUNT(DISTINCT TO_DAYS(COL_TIME_ON)) as Days from "
.$this->config->item('table_name'). " thcv .$this->config->item('table_name'). " thcv
where station_id = " . $station_id . " and COL_TIME_ON is not null group by year"; where station_id in (" . $location_list . ") and COL_TIME_ON is not null group by year";
$query = $this->db->query($sql); $query = $this->db->query($sql);
@ -151,12 +153,14 @@ class Dayswithqso_model extends CI_Model
*/ */
function getDates() { function getDates() {
$CI =& get_instance(); $CI =& get_instance();
$CI->load->model('Stations'); $CI->load->model('logbooks_model');
$station_id = $CI->Stations->find_active(); $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$location_list = "'".implode("','",$logbooks_locations_array)."'";
$sql = "select distinct cast(col_time_on as date) as date from " $sql = "select distinct cast(col_time_on as date) as date from "
.$this->config->item('table_name'). " thcv .$this->config->item('table_name'). " thcv
where station_id = " . $station_id . " order by date asc"; where station_id in (" . $location_list . ") order by date asc";
$query = $this->db->query($sql); $query = $this->db->query($sql);