diff --git a/application/controllers/Update.php b/application/controllers/Update.php
index d6cd88c3..59c914de 100644
--- a/application/controllers/Update.php
+++ b/application/controllers/Update.php
@@ -251,6 +251,11 @@ class Update extends CI_Controller {
$this->logbook_model->check_missing_continent();
}
+ public function update_distances() {
+ $this->load->model('logbook_model');
+ $this->logbook_model->update_distances();
+ }
+
public function check_missing_grid($all = false){
$this->load->model('logbook_model');
$this->logbook_model->check_missing_grid_id($all);
diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php
index 177a5bd2..2cccffbf 100755
--- a/application/models/Logbook_model.php
+++ b/application/models/Logbook_model.php
@@ -3618,6 +3618,36 @@ class Logbook_model extends CI_Model {
print("$count updated\n");
}
+ public function update_distances(){
+ $this->db->select("COL_PRIMARY_KEY, COL_GRIDSQUARE, station_gridsquare");
+ $this->db->join('station_profile', 'station_profile.station_id = '.$this->config->item('table_name').'.station_id');
+ $this->db->where("COL_DISTANCE is NULL");
+ $this->db->where("COL_GRIDSQUARE is NOT NULL");
+ $this->db->where("COL_GRIDSQUARE != ''");
+ $this->db->trans_start();
+ $query = $this->db->get($this->config->item('table_name'));
+
+ $count = 0;
+ if ($query->num_rows() > 0){
+ print("Affected QSOs: ".$this->db->affected_rows()."
");
+ $this->load->library('Qra');
+ foreach ($query->result() as $row) {
+ $distance = $this->qra->distance($row->station_gridsquare, $row->COL_GRIDSQUARE, 'K');
+ $data = array(
+ 'COL_DISTANCE' => $distance,
+ );
+
+ $this->db->where(array('COL_PRIMARY_KEY' => $row->COL_PRIMARY_KEY));
+ $this->db->update($this->config->item('table_name'), $data);
+ $count++;
+ }
+ print("QSOs updated: ".$count);
+ } else {
+ print "No QSOs affected.";
+ }
+ $this->db->trans_complete();
+ }
+
public function check_for_station_id() {
$this->db->where('station_id =', NULL);
$query = $this->db->get($this->config->item('table_name'));
diff --git a/application/views/update/index.php b/application/views/update/index.php
index 61380514..0d31deaa 100644
--- a/application/views/update/index.php
+++ b/application/views/update/index.php
@@ -3,44 +3,60 @@
Here you can update the DXCC lookup data that is used for displaying callsign information.
-This data is provided by Clublog.
- - -Here you can update the DXCC lookup data that is used for displaying callsign information.
+This data is provided by Clublog.
+ + ++ After updating, Cloudlog can fill in missing callsign information in the logbook using the newly-obtained DXCC data. + You can choose to check just the QSOs in the logbook that are missing DXCC metadata or to re-check the entire logbook + and update existing metadata as well, in case it has changed. +
+ + + ++ This function can be used to update QSO continent information for all QSOs in Cloudlog missing that information. +
+ + +- After updating, Cloudlog can fill in missing callsign information in the logbook using the newly-obtained DXCC data. - You can choose to check just the QSOs in the logbook that are missing DXCC metadata or to re-check the entire logbook - and update existing metadata as well, in case it has changed. -
- - - -- This function can be used to update QSO continent information for all QSOs in Cloudlog missing that information. -
-Check QSOs missing continent data
- - +Here you can update QSOs with missing distance information.
+ +