Init dxcc class only once during import

This commit is contained in:
Andreas Kristiansen
2026-01-25 11:15:05 +01:00
parent d5fc310ad1
commit 175cb5dcee
2 changed files with 19 additions and 6 deletions

View File

@@ -8,6 +8,7 @@ class Logbook_model extends CI_Model {
private $station_result = [];
private $spot_status_cache = []; // In-memory cache for DX cluster spot statuses
private $dxcc_object;
public function __construct() {
$this->oop_populate_modes();
@@ -194,7 +195,7 @@ class Logbook_model extends CI_Model {
$this->input->post('continent') == "");
if ($needs_dxcc_lookup) {
$dxccobj = new Dxcc($date);
$dxccobj = new Dxcc(null);
$dxcc = $dxccobj->dxcc_lookup(strtoupper(trim($callsign)), $datetime);
}
@@ -4913,13 +4914,17 @@ class Logbook_model extends CI_Model {
$entity = $this->get_entity($record['dxcc']);
$dxcc = array($record['dxcc'] ?? '', $entity['name'] ?? '');
} else {
$dxccobj = new Dxcc(null);
$dxcclookupresult = $dxccobj->dxcc_lookup($record['call'], $time_off);
if ($this->dxcc_object == null) {
$this->dxcc_object = new Dxcc(null);
}
$dxcclookupresult = $this->dxcc_object->dxcc_lookup($record['call'], $time_off);
$dxcc = array($dxcclookupresult['adif'], $dxcclookupresult['entity'], $dxcclookupresult['cqz'], $dxcclookupresult['cont']);
}
} else {
$dxccobj = new Dxcc(null);
$dxcclookupresult = $dxccobj->dxcc_lookup($record['call'], $time_off);
if ($this->dxcc_object == null) {
$this->dxcc_object = new Dxcc(null);
}
$dxcclookupresult = $this->dxcc_object->dxcc_lookup($record['call'], $time_off);
$dxcc = array($dxcclookupresult['adif'], $dxcclookupresult['entity'], $dxcclookupresult['cqz'], $dxcclookupresult['cont']);
}
} else {

View File

@@ -92,6 +92,7 @@ class Dxcc {
$row['cqz'] = 0;
$row['long'] = '0';
$row['lat'] = '0';
$row['cont'] = null;
return $row;
} else {
$call = $result . "AA";
@@ -127,7 +128,14 @@ class Dxcc {
}
}
return array("Not Found", "Not Found");
return array(
'adif' => 0,
'entity' => '- NONE ',
'cqz' => '0',
'long' => '0',
'lat' => '0',
'cont' => null
);
}
function wpx($testcall, $i) {