Make LoTW cert details query more verbose

This commit is contained in:
phl0
2025-10-26 11:43:40 +01:00
parent 25979356b5
commit 99741c2bb2
2 changed files with 16 additions and 5 deletions

View File

@@ -211,14 +211,26 @@ class Lotw extends CI_Controller {
// Get Certificate Data
$this->load->model('Lotw_model');
$data['station_profile'] = $station_profile;
$data['lotw_cert_info'] = $this->Lotw_model->lotw_cert_details($station_profile->station_callsign, $station_profile->station_dxcc, $station_profile->user_id);
$cert_query = $this->Lotw_model->lotw_cert_details($station_profile->station_callsign, $station_profile->user_id);
if ($cert_query->num_rows() > 1) {
echo $station_profile->station_callsign.": Multiple matching LoTW certificates found. Skipping.<br>";
continue;
}
// If Station Profile has no LoTW Cert continue on.
if(!isset($data['lotw_cert_info']->cert_dxcc_id)) {
if ($cert_query->num_rows() == 0) {
echo $station_profile->station_callsign.": No LoTW certificate for station callsign found.<br>";
continue;
}
$data['lotw_cert_info'] = $cert_query->row();
// Check if station profile DXCC matches cert DXCC
if ($data['lotw_cert_info']->cert_dxcc_id != $station_profile->station_dxcc) {
echo $station_profile->station_callsign.": DXCC of station profile does not match DXCC of LoTW certificate.<br>";
continue;
}
// Check if LoTW certificate itself is valid
// Validty of QSO dates will be checked later
$current_date = date('Y-m-d H:i:s');

View File

@@ -22,13 +22,12 @@ class Lotw_model extends CI_Model {
}
function lotw_cert_details($callsign, $dxcc, $user_id) {
$this->db->where('cert_dxcc_id', $dxcc);
function lotw_cert_details($callsign, $user_id) {
$this->db->where('user_id', $user_id);
$this->db->where('callsign', $callsign);
$query = $this->db->get('lotw_certs');
return $query->row();
return $query;
}
function find_cert($callsign, $dxcc, $user_id) {