Handle incorrect CQ zones

This commit is contained in:
phl0 2024-02-14 08:49:51 +01:00
parent 23088e4654
commit 0ae34b51bc
No known key found for this signature in database
GPG Key ID: 48EA1E640798CA9A
2 changed files with 21 additions and 24 deletions

View File

@ -2,21 +2,6 @@
class CQ extends CI_Model{
function get_zones(){
$CI =& get_instance();
$CI->load->model('Stations');
$station_id = $CI->Stations->find_active();
$data = $this->db->query(
"select COL_CQZ, count(COL_CQZ)
from ".$this->config->item('table_name')."
where COL_CQZ is not null and station_id = ".$station_id."
group by COL_CQZ order by COL_CQZ"
);
return $data->result();
}
function get_cq_array($bands, $postdata, $location_list) {
$cqZ = array(); // Used for keeping track of which states that are not worked
@ -95,7 +80,7 @@ class CQ extends CI_Model{
*/
function getCQWorked($location_list, $band, $postdata) {
$sql = "SELECT distinct col_cqz FROM " . $this->config->item('table_name') . " thcv
where station_id in (" . $location_list . ") and col_cqz <> ''";
where station_id in (" . $location_list . ") and col_cqz <= 40 and col_cqz <> ''";
if ($postdata['mode'] != 'All') {
$sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')";
@ -128,7 +113,7 @@ class CQ extends CI_Model{
*/
function getCQConfirmed($location_list, $band, $postdata) {
$sql = "SELECT distinct col_cqz FROM " . $this->config->item('table_name') . " thcv
where station_id in (" . $location_list . ") and col_cqz <> ''";
where station_id in (" . $location_list . ") and col_cqz <= 40 and col_cqz <> ''";
if ($postdata['mode'] != 'All') {
$sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')";
@ -199,7 +184,7 @@ class CQ extends CI_Model{
function getSummaryByBand($band, $postdata, $location_list) {
$sql = "SELECT count(distinct thcv.col_cqz) as count FROM " . $this->config->item('table_name') . " thcv";
$sql .= " where station_id in (" . $location_list . ') and col_cqz > 0';
$sql .= " where station_id in (" . $location_list . ') and col_cqz <= 40 and col_cqz > 0';
if ($band == 'SAT') {
$sql .= " and thcv.col_prop_mode ='" . $band . "'";
@ -229,7 +214,7 @@ class CQ extends CI_Model{
function getSummaryByBandConfirmed($band, $postdata, $location_list){
$sql = "SELECT count(distinct thcv.col_cqz) as count FROM " . $this->config->item('table_name') . " thcv";
$sql .= " where station_id in (" . $location_list . ') and col_cqz > 0';
$sql .= " where station_id in (" . $location_list . ') and col_cqz <= 40 and col_cqz > 0';
if ($band == 'SAT') {
$sql .= " and thcv.col_prop_mode ='" . $band . "'";

View File

@ -194,7 +194,7 @@ class QSO
$this->lotw = $this->getLotwString($data, $custom_date_format);
$this->eqsl = $this->getEqslString($data, $custom_date_format);
$this->cqzone = ($data['COL_CQZ'] === null) ? '' : '<a href="javascript:spawnLookupModal('.$data['COL_CQZ'].',\'cq\');">'.$data['COL_CQZ'].'</a>';
$this->cqzone = ($data['COL_CQZ'] === null) ? '' : $this->geCqLink($data['COL_CQZ']);
$this->state = ($data['COL_STATE'] === null) ? '' :$data['COL_STATE'];
$this->dxcc = (($data['name'] ?? null) === null) ? '- NONE -' : '<a href="javascript:spawnLookupModal('.$data['COL_DXCC'].',\'dxcc\');">'.ucwords(strtolower($data['name']), "- (/").'</a>';
$this->iota = ($data['COL_IOTA'] === null) ? '' : $this->getIotaLink($data['COL_IOTA']);
@ -209,6 +209,18 @@ class QSO
$this->operator = ($data['COL_OPERATOR'] === null) ? '' :$data['COL_OPERATOR'];
}
/**
* @return string
*/
function geCqLink($cqz): string
{
$cqz_link = '';
if ($cqz <= '40') {
return '<a href="javascript:spawnLookupModal('.$cqz.',\'cq\');">'.$cqz.'</a>';
}
return $cqz;
}
/**
* @return string
*/