Fix calls showing in the wrong dxcc region.

Added checks to dxcc_exceptons.
pull/537/head
Michael Bridak 2020-06-12 18:11:42 -07:00 zatwierdzone przez GitHub
rodzic 0e15b79f4e
commit cabe79a664
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 23 dodań i 10 usunięć

Wyświetl plik

@ -1915,6 +1915,18 @@ class Logbook_model extends CI_Model {
public function check_dxcc_table($call, $date){
$len = strlen($call);
$dxcc_exceptions = $this->db->select('`entity`, `adif`, `cqz`')
->where('call', $call)
->where('(start <= ', $date)
->or_where('start is null)', NULL, false)
->where('(end >= ', $date)
->or_where('end is null)', NULL, false)
->get('dxcc_exceptions');
if ($dxcc_exceptions->num_rows() > 0){
$row = $dxcc_exceptions->row_array();
return array($row['adif'], $row['entity'], $row['cqz']);
}
// query the table, removing a character from the right until a match
for ($i = $len; $i > 0; $i--){
//printf("searching for %s\n", substr($call, 0, $i));
@ -1940,18 +1952,19 @@ class Logbook_model extends CI_Model {
public function dxcc_lookup($call, $date){
$len = strlen($call);
$this->db->where('call', $call);
$this->db->where('CURDATE() between start and end');
$query = $this->db->get('dxcc_exceptions');
$dxcc_exceptions = $this->db->select('`entity`, `adif`, `cqz`')
->where('call', $call)
->where('(start <= CURDATE()')
->or_where('start is null', NULL, false)
->where('end >= CURDATE()')
->or_where('end is null)', NULL, false)
->get('dxcc_exceptions');
if ($query->num_rows() > 0){
$row = $query->row_array();
return $row;
if ($dxcc_exceptions->num_rows() > 0){
$row = $dxcc_exceptions->row_array();
return $row;
} else {
// query the table, removing a character from the right until a match
for ($i = $len; $i > 0; $i--){