Merge pull request #537 from mbridak/fix_dxcc_exceptions

Fix calls showing in the wrong dxcc region.
这个提交包含在:
Peter Goodhall 2020-06-13 15:37:01 +01:00 提交者 GitHub
当前提交 2393954b99
找不到此签名对应的密钥
GPG 密钥 ID: 4AEE18F83AFDEB23

查看文件

@ -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--){