mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
This fixes activated gridsquares where only a border or corner was worked
This commit is contained in:
@@ -3,100 +3,117 @@ if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Activators_model extends CI_Model
|
||||
{
|
||||
function get_activators($band, $mincount, $leogeo)
|
||||
{
|
||||
$this->load->model('logbooks_model');
|
||||
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
|
||||
|
||||
if ($mincount == '' || $mincount == 0 || !is_numeric($mincount)) {
|
||||
$mincount = 2;
|
||||
}
|
||||
function get_activators($band, $mincount, $leogeo) {
|
||||
$this->load->model('logbooks_model');
|
||||
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
|
||||
|
||||
if (!$logbooks_locations_array) {
|
||||
return null;
|
||||
}
|
||||
if ($mincount == '' || $mincount == 0 || !is_numeric($mincount)) {
|
||||
$mincount = 2;
|
||||
}
|
||||
|
||||
$location_list = "'" . implode("','", $logbooks_locations_array) . "'";
|
||||
if (!$logbooks_locations_array) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$sql = "SELECT COL_CALL as `call`,
|
||||
COUNT(DISTINCT(SUBSTR(COL_GRIDSQUARE,1,4))) AS `count`,
|
||||
GROUP_CONCAT(DISTINCT SUBSTR(`COL_GRIDSQUARE`,1,4) ORDER BY `COL_GRIDSQUARE` SEPARATOR ', ') AS `grids`
|
||||
FROM " . $this->config->item('table_name') . " WHERE station_id in (" . $location_list . ")";
|
||||
|
||||
if ($band != 'All') {
|
||||
if ($band == 'SAT') {
|
||||
switch ($leogeo) {
|
||||
case 'both':
|
||||
$sql .= " and col_prop_mode ='" . $band . "'";
|
||||
break;
|
||||
case 'leo':
|
||||
$sql .= " and col_prop_mode = '" . $band . "'";
|
||||
$sql .= " and col_sat_name != 'QO-100'";
|
||||
break;
|
||||
case 'geo':
|
||||
$sql .= " and col_prop_mode = '" . $band . "'";
|
||||
$sql .= " and col_sat_name = 'QO-100'";
|
||||
break;
|
||||
default:
|
||||
$sql .= " and col_prop_mode ='" . $band . "'";
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
$sql .= " and col_prop_mode !='SAT'";
|
||||
$sql .= " and COL_BAND ='" . $band . "'";
|
||||
}
|
||||
}
|
||||
$sql .= " AND `COL_GRIDSQUARE` != '' GROUP BY `COL_CALL` HAVING `count` >= " . $mincount . " ORDER BY `count` DESC;";
|
||||
$location_list = "'" . implode("','", $logbooks_locations_array) . "'";
|
||||
$binding = array();
|
||||
|
||||
$query = $this->db->query($sql);
|
||||
$sql = "select
|
||||
`call`,
|
||||
COUNT(distinct(grid)) as `count`,
|
||||
GROUP_CONCAT(distinct grid order by `grid` separator ', ') as `grids`
|
||||
from (
|
||||
select
|
||||
distinct COL_CALL as `call`,
|
||||
SUBSTR(COL_GRIDSQUARE, 1, 4) grid
|
||||
from
|
||||
" . $this->config->item('table_name') . "
|
||||
where
|
||||
station_id in (" . $location_list . ")
|
||||
and `COL_GRIDSQUARE` != ''";
|
||||
|
||||
return $query->result();
|
||||
}
|
||||
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;
|
||||
}
|
||||
} else {
|
||||
$sql .= " and col_prop_mode !='SAT'";
|
||||
$sql .= " and COL_BAND =?";
|
||||
}
|
||||
}
|
||||
|
||||
function get_activators_vucc($band, $leogeo)
|
||||
{
|
||||
$this->load->model('logbooks_model');
|
||||
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
|
||||
$sql .= " union
|
||||
select distinct COL_CALL as `call`, substr(grid, 1,4) as grid
|
||||
from (
|
||||
select TRIM(SUBSTRING_INDEX(SUBSTRING_INDEX(COL_VUCC_GRIDS, ',', x.x), ',',-1)) as grid, col_call from " . $this->config->item('table_name') . "
|
||||
cross join (
|
||||
select 1 as x
|
||||
union all
|
||||
select 2
|
||||
union all
|
||||
select 3
|
||||
union all
|
||||
select 4) x
|
||||
where x.x <= length(COL_VUCC_GRIDS)-length(replace(COL_VUCC_GRIDS, ',', ''))+ 1
|
||||
and coalesce(COL_VUCC_GRIDS, '') <> ''
|
||||
and station_id in (" . $location_list . ")";
|
||||
|
||||
if (!$logbooks_locations_array) {
|
||||
return null;
|
||||
}
|
||||
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;
|
||||
}
|
||||
} else {
|
||||
$sql .= " and col_prop_mode !='SAT'";
|
||||
$sql .= " and COL_BAND =?";
|
||||
}
|
||||
}
|
||||
|
||||
$location_list = "'" . implode("','", $logbooks_locations_array) . "'";
|
||||
$sql .= " GROUP BY 1
|
||||
) as z
|
||||
) as x
|
||||
group by `call`
|
||||
having `count` >= ?
|
||||
order by `count` desc";
|
||||
|
||||
$sql = "SELECT DISTINCT COL_CALL AS `call`,
|
||||
GROUP_CONCAT(COL_VUCC_GRIDS) AS `vucc_grids` FROM " . $this->config->item('table_name') .
|
||||
" WHERE station_id in (" . $location_list . ")";
|
||||
$binding[] = $mincount;
|
||||
|
||||
if ($band != 'All') {
|
||||
if ($band == 'SAT') {
|
||||
switch ($leogeo) {
|
||||
case 'both':
|
||||
$sql .= " and col_prop_mode ='" . $band . "'";
|
||||
break;
|
||||
case 'leo':
|
||||
$sql .= " and col_prop_mode = '" . $band . "'";
|
||||
$sql .= " and col_sat_name != 'QO-100'";
|
||||
break;
|
||||
case 'geo':
|
||||
$sql .= " and col_prop_mode = '" . $band . "'";
|
||||
$sql .= " and col_sat_name = 'QO-100'";
|
||||
break;
|
||||
default:
|
||||
$sql .= " and col_prop_mode ='" . $band . "'";
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
$sql .= " and col_prop_mode !='SAT'";
|
||||
$sql .= " and COL_BAND ='" . $band . "'";
|
||||
}
|
||||
}
|
||||
$sql .= " AND COL_VUCC_GRIDS != '' GROUP BY COL_CALL;";
|
||||
$query = $this->db->query($sql, $binding);
|
||||
|
||||
$query = $this->db->query($sql);
|
||||
return $query->result();
|
||||
|
||||
}
|
||||
|
||||
return $query->result();
|
||||
}
|
||||
function get_max_activated_grids()
|
||||
{
|
||||
$this->load->model('logbooks_model');
|
||||
@@ -110,8 +127,8 @@ class Activators_model extends CI_Model
|
||||
|
||||
// Get max no of activated grids of single operator
|
||||
$data = $this->db->query(
|
||||
"SELECT COUNT(DISTINCT(SUBSTR(COL_GRIDSQUARE,1,4))) AS `count` from " . $this->config->item('table_name') .
|
||||
" WHERE station_id in (" . $location_list . ") AND
|
||||
"SELECT COUNT(DISTINCT(SUBSTR(COL_GRIDSQUARE,1,4))) AS `count` from " . $this->config->item('table_name') .
|
||||
" WHERE station_id in (" . $location_list . ") AND
|
||||
`COL_GRIDSQUARE` != '' GROUP BY `COL_CALL` ORDER BY `count` DESC LIMIT 1"
|
||||
);
|
||||
foreach ($data->result() as $row) {
|
||||
|
||||
Reference in New Issue
Block a user