diff --git a/application/controllers/Callstats.php b/application/controllers/Callstats.php index f3c0d49d6..b813a60d1 100644 --- a/application/controllers/Callstats.php +++ b/application/controllers/Callstats.php @@ -36,7 +36,7 @@ class Callstats extends CI_Controller if ($this->input->post('propagation') != NULL) { // Propagation is not set when page first loads. $propagation = $this->input->post('propagation',true); } else { - $propagation = 'All'; + $propagation = ''; } if ($this->input->post('mincount') != NULL) { // mincount is not set when page first loads. @@ -45,10 +45,10 @@ class Callstats extends CI_Controller $mincount = 2; } - if ($this->input->post('leogeo') != NULL) { // orbit is not set when page first loads. - $orbit = $this->input->post('leogeo',true); + if ($this->input->post('orbit') != NULL) { // orbit is not set when page first loads. + $orbit = $this->input->post('orbit',true); } else { - $orbit = 'both'; + $orbit = 'All'; } @@ -61,6 +61,7 @@ class Callstats extends CI_Controller $data['sats'] = $this->bands->get_worked_sats(); $data['worked_bands'] = $this->bands->get_worked_bands(); $data['worked_modes'] = $this->Callstats_model->get_worked_modes(); + $data['orbits'] = $this->bands->get_worked_orbits(); $data['mincount'] = $mincount; $data['maxactivatedgrids'] = $this->Callstats_model->get_max_qsos(); $data['orbit'] = $orbit; @@ -97,7 +98,7 @@ class Callstats extends CI_Controller // Render Page $data['page_title'] = __("Log View"); - $data['filter'] = $searchphrase.__(" and band ").$band . __(" and mode ").$mode . __(" and satellite ").$sat . __(" and orbit ").$orbit . __(" and propagation ").$propagation; + $data['filter'] = $searchphrase.__(" and band ").$band; if ($band == 'SAT') { if ($sat != 'All' && $sat != null) { $data['filter'] .= __(" and sat ").$sat; diff --git a/application/models/Callstats_model.php b/application/models/Callstats_model.php index 898df9351..cde44b4eb 100644 --- a/application/models/Callstats_model.php +++ b/application/models/Callstats_model.php @@ -10,7 +10,7 @@ class Callstats_model extends CI_Model { $this->logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); } - function get_activators($band, $mode, $propagation, $mincount, $leogeo, $sat) { + function get_activators($band, $mode, $propagation, $mincount, $orbit, $sat) { if ($mincount == '' || $mincount == 0 || !is_numeric($mincount)) { $mincount = 2; @@ -27,39 +27,37 @@ class Callstats_model extends CI_Model { `col_call` as `call`, COUNT(*) as `count` from " . $this->config->item('table_name') . " + left join satellite on ".$this->config->item('table_name').".COL_SAT_NAME = satellite.name where station_id in (" . $location_list . ")"; if ($band != 'All') { - $binding[] = $band; if ($band == 'SAT') { - switch ($leogeo) { - case 'both': - $sql .= " and col_prop_mode = ?"; - break; - case 'leo': - $sql .= " and col_prop_mode = ?"; - $sql .= " and col_sat_name != 'QO-100'"; - break; - case 'geo': - $sql .= " and col_prop_mode = ?"; - $sql .= " and col_sat_name = 'QO-100'"; - break; - default: - $sql .= " and col_prop_mode = ?"; - break; - } - if ($sat != 'All') { + $sql .= " and col_prop_mode = ? "; + $binding[] = $band; + if ($sat != 'All' && $sat != '') { $sql .= " and col_sat_name = ?"; $binding[] = $sat; } } else { - $sql .= " and col_prop_mode != 'SAT'"; - $sql .= " and COL_BAND = ?"; + if ($propagation == 'None') { + $sql .= " and (trim(col_prop_mode) = '' or col_prop_mode is null)"; + } elseif ($propagation == 'NoSAT') { + $sql .= " and col_prop_mode != 'SAT'"; + } elseif ($propagation != '') { + $sql .= " and col_prop_mode = ?"; + $binding[] = $propagation; + } + $sql .= " and col_band = ?"; + $binding[] = $band; + } + } else { + if ($propagation == 'None') { + $sql .= " and (trim(col_prop_mode) = '' or col_prop_mode is null)"; + } elseif ($propagation == 'NoSAT') { + $sql .= " and col_prop_mode != 'SAT'"; + } elseif ($propagation != '') { + $sql .= " and col_prop_mode = ?"; + $binding[] = $propagation; } - } - - if (($propagation ?? 'All') != 'All') { - $this->db->where("COL_PROP_MODE = ?"); - $binding[] = $propagation; } if ($mode != 'All') { @@ -68,6 +66,11 @@ class Callstats_model extends CI_Model { $binding[] = $mode; } + if ($orbit != 'All') { + $sql .= " AND satellite.orbit = ?"; + $binding[] = $orbit; + } + $sql .= " group by `col_call` having `count` >= ? @@ -158,11 +161,11 @@ class Callstats_model extends CI_Model { } } - if ($orbit != 'both') { + if ($orbit != 'All') { $this->db->where('orbit', $orbit); } - if ($propagation != 'All') { + if ($propagation != '') { if ($propagation == 'None') { $this->db->where('COL_PROP_MODE', ''); } else if ($propagation == 'NoSAT') { diff --git a/application/views/callstats/index.php b/application/views/callstats/index.php index efec67669..3eae4fd4f 100644 --- a/application/views/callstats/index.php +++ b/application/views/callstats/index.php @@ -3,18 +3,20 @@