From ff7523a300793c8188d76a11a9e4a29eb6c911c7 Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Mon, 25 Apr 2022 11:33:39 +0100 Subject: [PATCH] [Map][Custom] Fixes issue with some callsigns being placed wrong --- application/controllers/Map.php | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/application/controllers/Map.php b/application/controllers/Map.php index 4abd750c..bfd1bb13 100644 --- a/application/controllers/Map.php +++ b/application/controllers/Map.php @@ -129,21 +129,18 @@ class Map extends CI_Controller { $count++; } else { - $query = $this->db->query(' - SELECT * - FROM dxcc_entities - WHERE prefix = SUBSTRING( \''.$row->COL_CALL.'\', 1, LENGTH( prefix ) ) - ORDER BY LENGTH( prefix ) DESC - LIMIT 1 - '); - - foreach ($query->result() as $dxcc) { - if($count != 1) { + if($count != 1) { echo ","; - } - echo "{\"lat\":\"".$dxcc->lat."\",\"lng\":\"".$dxcc->long."\", \"html\":\"Callsign: ".$row->COL_CALL."
Date/Time: ".$row->COL_TIME_ON."
Band: ".$row->COL_BAND."
Mode: ".$row->COL_MODE."\",\"label\":\"".$row->COL_CALL."\"}"; - $count++; } + + $result = $this->logbook_model->dxcc_lookup($row->COL_CALL, $row->COL_TIME_ON); + + if(isset($result)) { + $lat = $result['lat']; + $lng = $result['long']; + } + echo "{\"lat\":\"".$lat."\",\"lng\":\"".$lng."\", \"html\":\"Callsign: ".$row->COL_CALL."
Date/Time: ".$row->COL_TIME_ON."
Band: ".$row->COL_BAND."
Mode: ".$row->COL_MODE."\",\"label\":\"".$row->COL_CALL."\"}"; + $count++; } }