[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

查看文件

@ -21,35 +21,33 @@ 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() { function get_confirmed_sat_squares() {
$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'));
$this->db->select('distinct substring(COL_GRIDSQUARE,1,6) as SAT_SQUARE, COL_SAT_NAME', FALSE); $location_list = "'".implode("','",$logbooks_locations_array)."'";
$this->db->where_in('station_id', $logbooks_locations_array);
$this->db->where('COL_GRIDSQUARE !=', '');
$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')); $sql = 'SELECT distinct substring(COL_GRIDSQUARE,1,6) as SAT_SQUARE, COL_SAT_NAME FROM '
. $this->config->item('table_name')
. ' WHERE station_id in (' . $location_list . ') AND COL_GRIDSQUARE != "" AND COL_SAT_NAME != "" AND (COL_LOTW_QSL_RCVD = "Y" OR COL_QSL_RCVD = "Y")';
return $this->db->query($sql);
} }
function get_confirmed_sat_vucc_squares() { function get_confirmed_sat_vucc_squares() {
$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'));
$this->db->select('COL_VUCC_GRIDS, COL_SAT_NAME', FALSE); $location_list = "'".implode("','",$logbooks_locations_array)."'";
$this->db->where_in('station_id', $logbooks_locations_array);
$this->db->where('COL_VUCC_GRIDS !=', '');
$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')); $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() {
@ -91,24 +89,25 @@ class Gridsquares_model extends CI_Model {
$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') { if ($band != 'All') {
$this->db->where('COL_BAND', $band); $sql .= ' AND COL_BAND = "' . $band
$this->db->where('COL_PROP_MODE !=', "SAT"); .'"
$this->db->where('COL_PROP_MODE !=', "INTERNET"); AND COL_PROP_MODE != "SAT"
$this->db->where('COL_PROP_MODE !=', "ECH"); AND COL_PROP_MODE != "INTERNET"
$this->db->where('COL_PROP_MODE !=', "RPT"); AND COL_PROP_MODE != "ECH"
$this->db->where('COL_SAT_NAME =', ""); AND COL_PROP_MODE != "RPT"
AND COL_SAT_NAME = ""';
} }
$this->db->where('COL_LOTW_QSL_RCVD', 'Y'); $sql .= ' AND (COL_LOTW_QSL_RCVD = "Y" OR COL_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 search_band($band, $gridsquare) { function search_band($band, $gridsquare) {