From 19e6c54497817082076aac2b6d11e63502d5767b Mon Sep 17 00:00:00 2001
From: Andreas <6977712+AndreasK79@users.noreply.github.com>
Date: Fri, 28 Oct 2022 19:02:11 +0200
Subject: [PATCH 2/8] [Timeline] Added checkbox for qsl, lotw and eqsl
---
application/controllers/Timeline.php | 27 ++++++++++--
application/models/Timeline_model.php | 60 +++++++++++++++++++++++----
2 files changed, 75 insertions(+), 12 deletions(-)
diff --git a/application/controllers/Timeline.php b/application/controllers/Timeline.php
index 873215564..29ee54162 100644
--- a/application/controllers/Timeline.php
+++ b/application/controllers/Timeline.php
@@ -25,26 +25,47 @@ class Timeline extends CI_Controller {
$band = 'All';
}
- if ($this->input->post('mode') != NULL) { // Band is not set when page first loads.
+ if ($this->input->post('mode') != NULL) {
$mode = $this->input->post('mode');
}
else {
$mode = 'All';
}
- if ($this->input->post('awardradio') != NULL) { // Band is not set when page first loads.
+ if ($this->input->post('awardradio') != NULL) {
$award = $this->input->post('awardradio');
}
else {
$award = 'dxcc';
}
+ if ($this->input->post('qsl') != NULL) {
+ $qsl = $this->input->post('qsl');
+ }
+ else {
+ $qsl = '0';
+ }
+
+ if ($this->input->post('lotw') != NULL) {
+ $lotw = $this->input->post('lotw');
+ }
+ else {
+ $lotw = '0';
+ }
+
+ if ($this->input->post('eqsl') != NULL) {
+ $eqsl = $this->input->post('eqsl');
+ }
+ else {
+ $eqsl = '0';
+ }
+
$this->load->model('modes');
$this->load->model('bands');
$data['modes'] = $this->modes->active();
- $data['timeline_array'] = $this->Timeline_model->get_timeline($band, $mode, $award);
+ $data['timeline_array'] = $this->Timeline_model->get_timeline($band, $mode, $award, $qsl, $lotw, $eqsl);
$data['worked_bands'] = $this->bands->get_worked_bands();
$data['bandselect'] = $band;
$data['modeselect'] = $mode;
diff --git a/application/models/Timeline_model.php b/application/models/Timeline_model.php
index 72203337d..684bd732c 100644
--- a/application/models/Timeline_model.php
+++ b/application/models/Timeline_model.php
@@ -3,7 +3,7 @@ if (!defined('BASEPATH')) exit('No direct script access allowed');
class Timeline_model extends CI_Model
{
- function get_timeline($band, $mode, $award) {
+ function get_timeline($band, $mode, $award, $qsl, $lotw, $eqsl) {
$CI =& get_instance();
$CI->load->model('logbooks_model');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
@@ -15,16 +15,16 @@ class Timeline_model extends CI_Model
$location_list = "'".implode("','",$logbooks_locations_array)."'";
switch ($award) {
- case 'dxcc': $result = $this->get_timeline_dxcc($band, $mode, $location_list); break;
- case 'was': $result = $this->get_timeline_was($band, $mode, $location_list); break;
- case 'iota': $result = $this->get_timeline_iota($band, $mode, $location_list); break;
- case 'waz': $result = $this->get_timeline_waz($band, $mode, $location_list); break;
+ case 'dxcc': $result = $this->get_timeline_dxcc($band, $mode, $location_list, $qsl, $lotw, $eqsl); break;
+ case 'was': $result = $this->get_timeline_was($band, $mode, $location_list, $qsl, $lotw, $eqsl); break;
+ case 'iota': $result = $this->get_timeline_iota($band, $mode, $location_list, $qsl, $lotw, $eqsl); break;
+ case 'waz': $result = $this->get_timeline_waz($band, $mode, $location_list, $qsl, $lotw, $eqsl); break;
}
return $result;
}
- public function get_timeline_dxcc($band, $mode, $location_list) {
+ public function get_timeline_dxcc($band, $mode, $location_list, $qsl, $lotw, $eqsl) {
$sql = "select min(date(COL_TIME_ON)) date, prefix, col_country, end, adif from "
.$this->config->item('table_name'). " thcv
join dxcc_entities on thcv.col_dxcc = dxcc_entities.adif
@@ -44,6 +44,8 @@ class Timeline_model extends CI_Model
$sql .= " and col_mode ='" . $mode . "'";
}
+ $sql .= $this->addQslToQuery($qsl, $lotw, $eqsl);
+
$sql .= " group by col_dxcc, col_country
order by date desc";
@@ -52,7 +54,7 @@ class Timeline_model extends CI_Model
return $query->result();
}
- public function get_timeline_was($band, $mode, $location_list) {
+ public function get_timeline_was($band, $mode, $location_list, $qsl, $lotw, $eqsl) {
$sql = "select min(date(COL_TIME_ON)) date, col_state from "
.$this->config->item('table_name'). " thcv
where station_id in (" . $location_list . ")";
@@ -74,6 +76,8 @@ class Timeline_model extends CI_Model
$sql .= " and COL_DXCC in ('291', '6', '110')";
$sql .= " and COL_STATE in ('AK','AL','AR','AZ','CA','CO','CT','DE','FL','GA','HI','IA','ID','IL','IN','KS','KY','LA','MA','MD','ME','MI','MN','MO','MS','MT','NC','ND','NE','NH','NJ','NM','NV','NY','OH','OK','OR','PA','RI','SC','SD','TN','TX','UT','VA','VT','WA','WI','WV','WY')";
+ $sql .= $this->addQslToQuery($qsl, $lotw, $eqsl);
+
$sql .= " group by col_state
order by date desc";
@@ -82,7 +86,7 @@ class Timeline_model extends CI_Model
return $query->result();
}
- public function get_timeline_iota($band, $mode, $location_list) {
+ public function get_timeline_iota($band, $mode, $location_list, $qsl, $lotw, $eqsl) {
$sql = "select min(date(COL_TIME_ON)) date, col_iota, name, prefix from "
.$this->config->item('table_name'). " thcv
join iota on thcv.col_iota = iota.tag
@@ -102,6 +106,8 @@ class Timeline_model extends CI_Model
$sql .= " and col_mode ='" . $mode . "'";
}
+ $sql .= $this->addQslToQuery($qsl, $lotw, $eqsl);
+
$sql .= " and col_iota <> '' group by col_iota, name, prefix
order by date desc";
@@ -110,7 +116,7 @@ class Timeline_model extends CI_Model
return $query->result();
}
- public function get_timeline_waz($band, $mode, $location_list) {
+ public function get_timeline_waz($band, $mode, $location_list, $qsl, $lotw, $eqsl) {
$sql = "select min(date(COL_TIME_ON)) date, col_cqz from "
.$this->config->item('table_name'). " thcv
where station_id in (" . $location_list . ")";
@@ -129,6 +135,8 @@ class Timeline_model extends CI_Model
$sql .= " and col_mode ='" . $mode . "'";
}
+ $sql .= $this->addQslToQuery($qsl, $lotw, $eqsl);
+
$sql .= " and col_cqz <> '' group by col_cqz
order by date desc";
@@ -136,5 +144,39 @@ class Timeline_model extends CI_Model
return $query->result();
}
+
+
+ // Adds confirmation to query
+ function addQslToQuery($qsl, $lotw, $eqsl) {
+ $sql = '';
+ if ($lotw == 1 and $qsl == 0 and $eqsl == 0) {
+ $sql .= " and col_lotw_qsl_rcvd = 'Y'";
+ }
+
+ if ($qsl == 1 and $lotw == 0 and $eqsl == 0) {
+ $sql .= " and col_qsl_rcvd = 'Y'";
+ }
+
+ if ($eqsl == 1 and $lotw == 0 and $qsl == 0) {
+ $sql .= " and col_eqsl_qsl_rcvd = 'Y'";
+ }
+
+ if ($lotw == 1 and $qsl == 1 and $eqsl == 0) {
+ $sql .= " and (col_lotw_qsl_rcvd = 'Y' or col_qsl_rcvd = 'Y')";
+ }
+
+ if ($qsl == 1 and $lotw == 0 and $eqsl == 1) {
+ $sql .= " and (col_qsl_rcvd = 'Y' or col_eqsl_qsl_rcvd = 'Y')";
+ }
+
+ if ($eqsl == 1 and $lotw == 1 and $qsl == 0) {
+ $sql .= " and (col_eqsl_qsl_rcvd = 'Y' or col_lotw_qsl_rcvd = 'Y')";
+ }
+
+ if ($qsl == 1 && $lotw == 1 && $eqsl == 1) {
+ $sql .= " and (col_qsl_rcvd = 'Y' or col_lotw_qsl_rcvd = 'Y' or col_eqsl_qsl_rcvd = 'Y')";
+ }
+ return $sql;
+ }
}
From a9210ecad7f82574d42b85e1e5bcb9d6f7043dee Mon Sep 17 00:00:00 2001
From: Andreas <6977712+AndreasK79@users.noreply.github.com>
Date: Sun, 30 Oct 2022 08:02:32 +0100
Subject: [PATCH 3/8] [Contesting] Triggers table search when entering call
---
assets/js/sections/contesting.js | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/assets/js/sections/contesting.js b/assets/js/sections/contesting.js
index 2b246e4dc..0a0701a65 100644
--- a/assets/js/sections/contesting.js
+++ b/assets/js/sections/contesting.js
@@ -189,6 +189,8 @@ $("#callsign").keyup(function () {
highlight(call.toUpperCase());
});
checkIfWorkedBefore();
+ var qTable = $('.qsotable').DataTable();
+ qTable.search(call).draw();
}
else if (call.length <= 2) {
$('.callsign-suggestions').text("");
@@ -226,6 +228,9 @@ function reset_log_fields() {
$("#callsign").focus();
setRst($("#mode").val());
$('#callsign_info').text("");
+
+ var qTable = $('.qsotable').DataTable();
+ qTable.search('').draw();
}
RegExp.escape = function (text) {
@@ -396,6 +401,9 @@ function logQso() {
localStorage.setItem("gridsquarereceived", $("#exch_gridsquare_r").val());
localStorage.setItem("gridsquaresent", $("#exch_gridsquare_s").val());
localStorage.setItem("copytodok", $('#copyexchangetodok').is(":checked"));
+
+ var qTable = $('.qsotable').DataTable();
+ qTable.search('').draw();
}
});
}
From 7a81d98dd6e638aef3c772df0942fedb79b3716d Mon Sep 17 00:00:00 2001
From: Andreas <6977712+AndreasK79@users.noreply.github.com>
Date: Sun, 30 Oct 2022 16:53:01 +0100
Subject: [PATCH 4/8] [QSO] Fixed broken QSL image upload. Tag wasn't closed
correctly.
---
application/views/view_log/qso.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/application/views/view_log/qso.php b/application/views/view_log/qso.php
index e334a63ac..c8f7f1e06 100644
--- a/application/views/view_log/qso.php
+++ b/application/views/view_log/qso.php
@@ -298,7 +298,7 @@
config->item('use_auth') && ($this->session->userdata('user_type') >= 2)) || $this->config->item('use_auth') === FALSE) { ?>
-
+
Date: Mon, 31 Oct 2022 12:25:56 +0100
Subject: [PATCH 5/8] [Search] Added tab to check for duplicate QSOs
---
application/controllers/Logbook.php | 31 ++++++++++++
application/controllers/Search.php | 12 +++++
application/views/interface_assets/footer.php | 23 +++++++++
application/views/search/duplicates.php | 43 ++++++++++++++++
.../views/search/duplicates_result.php | 49 +++++++++++++++++++
application/views/search/filter.php | 3 ++
application/views/search/main.php | 3 ++
7 files changed, 164 insertions(+)
create mode 100644 application/views/search/duplicates.php
create mode 100644 application/views/search/duplicates_result.php
diff --git a/application/controllers/Logbook.php b/application/controllers/Logbook.php
index 782334651..cbe6aa110 100755
--- a/application/controllers/Logbook.php
+++ b/application/controllers/Logbook.php
@@ -698,7 +698,38 @@ class Logbook extends CI_Controller {
}
}
+ function search_duplicates($station_id) {
+ $station_id = $this->security->xss_clean($station_id);
+ $this->load->model('user_model');
+
+ if(!$this->user_model->authorize($this->config->item('auth_mode'))) { return; }
+
+ $CI =& get_instance();
+ $CI->load->model('logbooks_model');
+ $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
+
+ if (!$logbooks_locations_array) {
+ return null;
+ }
+
+ $location_list = "'".implode("','",$logbooks_locations_array)."'";
+
+ $sql = 'select count(*) as occurence, COL_CALL, COL_MODE, COL_SUBMODE, station_callsign, COL_SAT_NAME, COL_BAND, min(col_time_on) Mintime, max(col_time_on) Maxtime from ' . $this->config->item('table_name') .
+ ' join station_profile on ' . $this->config->item('table_name') . '.station_id = station_profile.station_id where ' . $this->config->item('table_name') .'.station_id in ('. $location_list . ')';
+
+ if ($station_id != 'All') {
+ $sql .= ' and station_profile.station_id = ' . $station_id;
+ }
+
+ $sql .= ' group by col_call, col_mode, COL_SUBMODE, STATION_CALLSIGN, col_band, COL_SAT_NAME having count(*) > 1 and timediff(maxtime, mintime) < 3000';
+
+ $query = $this->db->query($sql);
+
+ $data['qsos'] = $query;
+
+ $this->load->view('search/duplicates_result.php', $data);
+ }
/*
* Provide a dxcc search, returning results json encoded
diff --git a/application/controllers/Search.php b/application/controllers/Search.php
index b6e8dd65c..024abba8b 100644
--- a/application/controllers/Search.php
+++ b/application/controllers/Search.php
@@ -56,6 +56,18 @@ class Search extends CI_Controller {
}
}
+ // Searches for duplicate QSOs within 30m of time difference
+ public function duplicates() {
+ $this->load->model('stations');
+
+ $data['station_profile'] = $this->stations->all_of_user();
+ $data['page_title'] = "Duplicate QSOs within 30m time difference";
+
+ $this->load->view('interface_assets/header', $data);
+ $this->load->view('search/duplicates');
+ $this->load->view('interface_assets/footer');
+ }
+
function json_result() {
if(isset($_POST['search'])) {
$result = $this->fetchQueryResult($_POST['search'], false);
diff --git a/application/views/interface_assets/footer.php b/application/views/interface_assets/footer.php
index 3e6ebe421..665d779ac 100644
--- a/application/views/interface_assets/footer.php
+++ b/application/views/interface_assets/footer.php
@@ -895,6 +895,29 @@ function getLookupResult() {
+
+uri->segment(1) == "search") { ?>