[DBTools] Added a checking for IOTA vs DXCC

This commit is contained in:
Andreas Kristiansen
2026-01-11 09:06:33 +01:00
parent e9f07a2385
commit 7fb421b76b
4 changed files with 255 additions and 40 deletions

View File

@@ -1646,6 +1646,8 @@ class Logbookadvanced_model extends CI_Model {
return $this->getIncorrectCqZones();
case 'checkincorrectituzones':
return $this->getIncorrectItuZones();
case 'checkiota':
return $this->checkIota();
default:
return null;
}
@@ -2075,4 +2077,47 @@ class Logbookadvanced_model extends CI_Model {
return $query->result();
}
/*
* Get list of QSOs with IOTA that do not match the IOTAs listed for the DXCC.
* Some islands are excluded as they can be in multiple DXCCs.
* These are excluded:
* 'AF-034','AF-055','AF-071','AS-004','AS-034','AS-035','AS-052','EU-005','EU-053',
* 'EU-098','EU-115','EU-117','EU-129','EU-154','EU-191','EU-192','NA-015','NA-096',
* 'NA-105','OC-034','OC-061','OC-088','OC-148','SA-008', 'OC-295'
*/
public function checkIota() {
$sql = "select col_primary_key, col_time_on, col_call, col_band, col_gridsquare, col_dxcc, col_country, station_profile_name, col_lotw_qsl_rcvd, col_mode, col_submode, col_iota,
(
select group_concat(distinct dxcc_entities.name order by dxcc_entities.name separator ', ')
from iota
join dxcc_entities on dxcc_entities.adif = iota.dxccid
where iota.tag = thcv.col_iota
order by iota.dxccid asc
) as correctdxcc
from " . $this->config->item('table_name') . " thcv
join station_profile on thcv.station_id = station_profile.station_id
join dxcc_entities on dxcc_entities.adif = thcv.COL_DXCC
where station_profile.user_id = ?
and thcv.col_dxcc > 0
and not exists (
select 1
from iota
where dxccid = thcv.col_dxcc
and tag = thcv.col_iota
)
and thcv.col_dxcc > 0
and thcv.col_iota is not null
and thcv.col_iota <> ''
and thcv.col_iota not in ('AF-034','AF-055','AF-071','AS-004','AS-034','AS-035','AS-052','EU-005','EU-053',
'EU-098','EU-115','EU-117','EU-129','EU-154','EU-191','EU-192','NA-015','NA-096',
'NA-105','OC-034','OC-061','OC-088','OC-148','SA-008', 'OC-295')
order by station_profile_name, col_time_on desc;";
$bindings[] = [$this->session->userdata('user_id')];
$query = $this->db->query($sql, $bindings);
return $query->result();
}
}