[US Counties Award] Updated code to support station logbooks

pull/1160/head
Andreas 2021-09-09 22:43:29 +02:00
rodzic a6422fa341
commit 9f6feb24a5
2 zmienionych plików z 17 dodań i 15 usunięć

Wyświetl plik

@ -28,14 +28,18 @@ class Counties extends CI_Model
* No band split, as it only count the number of counties in the award.
*/
function get_counties_summary() {
$station_id = $this->get_station_id();
$CI =& get_instance();
$CI->load->model('logbooks_model');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$location_list = "'".implode("','",$logbooks_locations_array)."'";
$sql = "select count(distinct COL_CNTY) countycountworked, coalesce(x.countycountconfirmed, 0) countycountconfirmed, thcv.COL_STATE
from " . $this->config->item('table_name') . " thcv
left outer join (
select count(distinct COL_CNTY) countycountconfirmed, COL_STATE
from " . $this->config->item('table_name') .
" where station_id =" . $station_id .
" where station_id in (" . $location_list . ")" .
" and COL_DXCC in ('291', '6', '110')
and coalesce(COL_CNTY, '') <> ''
and COL_BAND != 'SAT'
@ -43,7 +47,7 @@ class Counties extends CI_Model
group by COL_STATE
order by COL_STATE
) x on thcv.COL_STATE = x.COL_STATE
where station_id =" . $station_id .
where station_id in (" . $location_list . ")" .
" and COL_DXCC in ('291', '6', '110')
and coalesce(COL_CNTY, '') <> ''
and COL_BAND != 'SAT'
@ -54,12 +58,6 @@ class Counties extends CI_Model
return $query->result_array();
}
function get_station_id() {
$CI =& get_instance();
$CI->load->model('Stations');
return $CI->Stations->find_active();
}
/*
* Makes a list of all counties in given state
*/
@ -78,11 +76,15 @@ class Counties extends CI_Model
}
function get_counties($state, $confirmationtype) {
$station_id = $this->get_station_id();
$CI =& get_instance();
$CI->load->model('logbooks_model');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$location_list = "'".implode("','",$logbooks_locations_array)."'";
$sql = "select distinct COL_CNTY, COL_STATE
from " . $this->config->item('table_name') . " thcv
where station_id =" . $station_id .
where station_id in (" . $location_list . ")" .
" and COL_DXCC in ('291', '6', '110')
and coalesce(COL_CNTY, '') <> ''
and COL_BAND != 'SAT'";

Wyświetl plik

@ -2483,11 +2483,11 @@ class Logbook_model extends CI_Model {
}
function county_qso_details($state, $county) {
$CI =& get_instance();
$CI->load->model('Stations');
$station_id = $CI->Stations->find_active();
$CI =& get_instance();
$CI->load->model('logbooks_model');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$this->db->where('station_id', $station_id);
$this->db->where_in('station_id', $logbooks_locations_array);
$this->db->where('COL_STATE', $state);
$this->db->where('COL_CNTY', $county);
$this->db->where('COL_PROP_MODE !=', 'SAT');