diff --git a/application/controllers/Map.php b/application/controllers/Map.php index 456b23cb..d26fe437 100644 --- a/application/controllers/Map.php +++ b/application/controllers/Map.php @@ -80,13 +80,23 @@ class Map extends CI_Controller { $offset = (intval($this->input->post('offset'))>0)?xss_clean($this->input->post('offset')):null; $qsos = $this->logbook_model->get_qsos($nb_qso, $offset); } - // [PLOT] ADD plot // - $plot_array = $this->logbook_model->get_plot_array_for_map($qsos->result()); - // [MAP Custom] ADD Station // - $station_array = $this->Stations->get_station_array_for_map(); - header('Content-Type: application/json; charset=utf-8'); - echo json_encode(array_merge($plot_array, $station_array)); - } + if(empty($qsos)) { + // Handle the case where $qsos is empty -} + // return json with error "No QSOs found" + header('Content-Type: application/json; charset=utf-8'); + echo json_encode(array('error' => 'No QSOs found')); + } else { + // Handle the case where $qsos is not empty + // [PLOT] ADD plot // + $plot_array = $this->logbook_model->get_plot_array_for_map($qsos->result()); + // [MAP Custom] ADD Station // + $station_array = $this->Stations->get_station_array_for_map(); + + header('Content-Type: application/json; charset=utf-8'); + echo json_encode(array_merge($plot_array, $station_array)); + } + + } +} \ No newline at end of file diff --git a/application/views/interface_assets/footer.php b/application/views/interface_assets/footer.php index 846d6167..e355472b 100644 --- a/application/views/interface_assets/footer.php +++ b/application/views/interface_assets/footer.php @@ -895,30 +895,34 @@ if ($this->session->userdata('user_id') != null) { fetch(qso_loc) .then(response => response.json()) .then(data => { - var newMarkers = {}; - data.markers.forEach(marker => { - var key = `${marker.lat},${marker.lng}`; - var html = `