mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
Added another layer for 1 char suffixes
This commit is contained in:
@@ -794,6 +794,34 @@ class Calltester extends CI_Controller {
|
||||
'Date' => $date = date('Y-m-d', time())
|
||||
);
|
||||
|
||||
$testarray[] = array(
|
||||
'Callsign' => 'VP8ADR/40',
|
||||
'Country' => 'Falkland Islands',
|
||||
'Adif' => 141,
|
||||
'Date' => $date = date('Y-m-d', time())
|
||||
);
|
||||
|
||||
$testarray[] = array(
|
||||
'Callsign' => 'VP8ADR/400',
|
||||
'Country' => 'Falkland Islands',
|
||||
'Adif' => 141,
|
||||
'Date' => $date = date('Y-m-d', time())
|
||||
);
|
||||
|
||||
$testarray[] = array(
|
||||
'Callsign' => 'LU7CC/E',
|
||||
'Country' => 'Argentina',
|
||||
'Adif' => 100,
|
||||
'Date' => $date = date('Y-m-d', time())
|
||||
);
|
||||
|
||||
$testarray[] = array(
|
||||
'Callsign' => 'FR/F6KDF/T',
|
||||
'Country' => 'Tromelin Island',
|
||||
'Adif' => 276,
|
||||
'Date' => '1999-08-04'
|
||||
);
|
||||
|
||||
set_time_limit(3600);
|
||||
|
||||
// Starting clock time in seconds
|
||||
@@ -806,7 +834,7 @@ class Calltester extends CI_Controller {
|
||||
$dxccobj = new Dxcc(null);
|
||||
|
||||
foreach ($testarray as $call) {
|
||||
$i++;
|
||||
$i++;
|
||||
$dxcc = $dxccobj->dxcc_lookup($call['Callsign'], $call['Date']);
|
||||
|
||||
$dxcc['adif'] = (isset($dxcc['adif'])) ? $dxcc['adif'] : 0;
|
||||
|
||||
@@ -195,6 +195,14 @@ class Dxcc {
|
||||
return null; # exit, undef
|
||||
}
|
||||
|
||||
if (preg_match('/^[0-9]{2,}$/', $c)) { # If suffix consists of two or more digits -> ignore suffix, To catch callsigns like VP8ADR/40
|
||||
$c = null;
|
||||
}
|
||||
|
||||
if (preg_match('/^[A-Z]{1}$/', ($c ?? ''))) { # If suffix consists of exactly one letter -> ignore suffix, To catch callsigns like LU7CC/E
|
||||
$c = null;
|
||||
}
|
||||
|
||||
# Depending on these values we have to determine the prefix.
|
||||
# Following cases are possible:
|
||||
#
|
||||
@@ -280,8 +288,8 @@ class Dxcc {
|
||||
$prefix = $matches[1];
|
||||
} elseif (preg_match($this->noneadditions, $c)) {
|
||||
return '';
|
||||
} elseif (preg_match('/^\d\d+$/', $c)) { # more than 2 numbers -> ignore
|
||||
if (!preg_match('/(.+\d)[A-Z]* /', $b, $matches)) {
|
||||
} elseif (preg_match('/^\d\d+$/', $c)) { # more than 2 numbers -> ignore
|
||||
if (!preg_match('/(.+\d)[A-Z]*/', $b, $matches)) {
|
||||
$this->logError('preg_match failed for multi-digit case', [
|
||||
'testcall' => $testcall,
|
||||
'b' => $b,
|
||||
@@ -303,7 +311,7 @@ class Dxcc {
|
||||
$prefix = $c . "0";
|
||||
}
|
||||
}
|
||||
} elseif (($a) && (preg_match($this->noneadditions, $c))) { # Case 2.1, X/CALL/X ie TF/DL2NWK/MM - DXCC none
|
||||
} elseif (($a) && (preg_match($this->noneadditions, ($c ?? '')))) { # Case 2.1, X/CALL/X ie TF/DL2NWK/MM - DXCC none
|
||||
return '';
|
||||
} elseif ($a) {
|
||||
# $a contains the prefix we want
|
||||
|
||||
Reference in New Issue
Block a user