Skip to content

Commit

Permalink
Fetches state from previous QSO. Fixes #854
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreasK79 committed Feb 8, 2021
1 parent 0d2fe0a commit c35d0d2
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions application/controllers/Logbook.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ function json($callsign, $type, $band, $mode)
$return['callsign_qth'] = $this->logbook_model->call_qth($callsign);
$return['callsign_iota'] = $this->logbook_model->call_iota($callsign);
$return['qsl_manager'] = $this->logbook_model->call_qslvia($callsign);
$return['callsign_state'] = $this->logbook_model->call_state($callsign);
$return['bearing'] = $this->bearing($return['callsign_qra'], $measurement_base);
$return['workedBefore'] = $this->worked_grid_before($return['callsign_qra'], $type, $band, $mode);

Expand Down
20 changes: 20 additions & 0 deletions application/models/Logbook_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -661,6 +661,26 @@ function call_qslvia($callsign) {
return $qsl_via;
}

function call_state($callsign) {
$this->db->select('COL_CALL, COL_STATE');
$this->db->where('COL_CALL', $callsign);
$where = "COL_NAME != \"\"";

$this->db->where($where);

$this->db->order_by("COL_TIME_ON", "desc");
$this->db->limit(1);
$query = $this->db->get($this->config->item('table_name'));
$name = "";
if ($query->num_rows() > 0)
{
$data = $query->row();
$qsl_state = $data->COL_STATE;
}

return $qsl_state;
}

function call_qth($callsign) {
$this->db->select('COL_CALL, COL_QTH, COL_TIME_ON');
$this->db->where('COL_CALL', $callsign);
Expand Down

0 comments on commit c35d0d2

Please sign in to comment.