[Gridsquare Map] Bugfix. The confirmed fields would not be correct. Or_where seems to work only when where are two conditions in the where statement.

这个提交包含在:
Andreas 2021-09-17 18:11:25 +02:00
父节点 e6df7bc96f
当前提交 25bffdce83

查看文件

@ -7,7 +7,7 @@ class Gridsquares_model extends CI_Model {
// Call the Model constructor // Call the Model constructor
parent::__construct(); parent::__construct();
} }
function get_worked_sat_squares() { function get_worked_sat_squares() {
$CI =& get_instance(); $CI =& get_instance();
$CI->load->model('logbooks_model'); $CI->load->model('logbooks_model');
@ -21,36 +21,34 @@ class Gridsquares_model extends CI_Model {
return $this->db->get($this->config->item('table_name')); return $this->db->get($this->config->item('table_name'));
} }
function get_confirmed_sat_squares() {
$CI =& get_instance();
$CI->load->model('logbooks_model');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
function get_confirmed_sat_squares() { $location_list = "'".implode("','",$logbooks_locations_array)."'";
$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->select('distinct substring(COL_GRIDSQUARE,1,6) as SAT_SQUARE, COL_SAT_NAME', FALSE); $sql = 'SELECT distinct substring(COL_GRIDSQUARE,1,6) as SAT_SQUARE, COL_SAT_NAME FROM '
$this->db->where_in('station_id', $logbooks_locations_array); . $this->config->item('table_name')
$this->db->where('COL_GRIDSQUARE !=', ''); . ' WHERE station_id in (' . $location_list . ') AND COL_GRIDSQUARE != "" AND COL_SAT_NAME != "" AND (COL_LOTW_QSL_RCVD = "Y" OR COL_QSL_RCVD = "Y")';
$this->db->where('COL_SAT_NAME !=', '');
$this->db->where('COL_LOTW_QSL_RCVD', 'Y');
$this->db->or_where('COL_QSL_RCVD', 'Y');
return $this->db->get($this->config->item('table_name')); return $this->db->query($sql);
} }
function get_confirmed_sat_vucc_squares() {
$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->select('COL_VUCC_GRIDS, COL_SAT_NAME', FALSE); function get_confirmed_sat_vucc_squares() {
$this->db->where_in('station_id', $logbooks_locations_array); $CI =& get_instance();
$this->db->where('COL_VUCC_GRIDS !=', ''); $CI->load->model('logbooks_model');
$this->db->where('COL_SAT_NAME !=', ''); $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$this->db->where('COL_LOTW_QSL_RCVD', 'Y');
$this->db->or_where('COL_QSL_RCVD', 'Y');
return $this->db->get($this->config->item('table_name')); $location_list = "'".implode("','",$logbooks_locations_array)."'";
}
$sql = 'SELECT COL_VUCC_GRIDS, COL_SAT_NAME FROM '
. $this->config->item('table_name')
. ' WHERE station_id in (' . $location_list . ') AND COL_VUCC_GRIDS != "" AND COL_SAT_NAME != "" AND (COL_LOTW_QSL_RCVD = "Y" OR COL_QSL_RCVD = "Y") AND (COL_LOTW_QSL_RCVD = "Y" OR COL_QSL_RCVD = "Y")';
return $this->db->query($sql);
}
function get_worked_sat_vucc_squares() { function get_worked_sat_vucc_squares() {
$CI =& get_instance(); $CI =& get_instance();
@ -86,30 +84,31 @@ class Gridsquares_model extends CI_Model {
return $this->db->get($this->config->item('table_name')); return $this->db->get($this->config->item('table_name'));
} }
function get_band_confirmed($band) { function get_band_confirmed($band) {
$CI =& get_instance(); $CI =& get_instance();
$CI->load->model('logbooks_model'); $CI->load->model('logbooks_model');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$location_list = "'".implode("','",$logbooks_locations_array)."'";
$this->db->select('distinct substring(COL_GRIDSQUARE,1,6) as GRID_SQUARES, COL_BAND', FALSE); $sql = 'SELECT distinct substring(COL_GRIDSQUARE,1,6) as GRID_SQUARES, COL_BAND FROM '
$this->db->where_in('station_id', $logbooks_locations_array); .$this->config->item('table_name')
$this->db->where('COL_GRIDSQUARE !=', ''); .' WHERE station_id in ('
.$location_list.') AND COL_GRIDSQUARE != ""';
if ($band != 'All') {
$sql .= ' AND COL_BAND = "' . $band
.'"
AND COL_PROP_MODE != "SAT"
AND COL_PROP_MODE != "INTERNET"
AND COL_PROP_MODE != "ECH"
AND COL_PROP_MODE != "RPT"
AND COL_SAT_NAME = ""';
}
if ($band != 'All') { $sql .= ' AND (COL_LOTW_QSL_RCVD = "Y" OR COL_QSL_RCVD = "Y")';
$this->db->where('COL_BAND', $band);
$this->db->where('COL_PROP_MODE !=', "SAT");
$this->db->where('COL_PROP_MODE !=', "INTERNET");
$this->db->where('COL_PROP_MODE !=', "ECH");
$this->db->where('COL_PROP_MODE !=', "RPT");
$this->db->where('COL_SAT_NAME =', "");
}
$this->db->where('COL_LOTW_QSL_RCVD', 'Y'); return $this->db->query($sql);
$this->db->or_where('COL_QSL_RCVD', 'Y'); }
return $this->db->get($this->config->item('table_name'));
}
function search_band($band, $gridsquare) { function search_band($band, $gridsquare) {
$CI =& get_instance(); $CI =& get_instance();