Skip to content

Commit d181bd1

Browse files
authored
Merge pull request wavelog#288 from phl0/harmonizeGridLookup
Use current band to check if grid worked
2 parents 1c83944 + cc1700d commit d181bd1

File tree

3 files changed

+14
-18
lines changed

3 files changed

+14
-18
lines changed

application/controllers/Logbook.php

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,10 @@ function jsonentity($adif) {
8484
echo json_encode($return, JSON_PRETTY_PRINT);
8585
}
8686

87-
function json($tempcallsign, $temptype, $tempband, $tempmode, $tempstation_id = null) {
87+
function json($tempcallsign, $tempband, $tempmode, $tempstation_id = null) {
8888
session_write_close();
8989
// Cleaning for security purposes
9090
$callsign = $this->security->xss_clean($tempcallsign);
91-
$type = $this->security->xss_clean($temptype);
9291
$band = $this->security->xss_clean($tempband);
9392
$mode = $this->security->xss_clean($tempmode);
9493
$station_id = $this->security->xss_clean($tempstation_id);
@@ -134,7 +133,7 @@ function json($tempcallsign, $temptype, $tempband, $tempmode, $tempstation_id =
134133

135134
$lookupcall=$this->get_plaincall($callsign);
136135

137-
$return['partial'] = $this->partial($lookupcall);
136+
$return['partial'] = $this->partial($lookupcall, $band);
138137

139138
$callbook = $this->logbook_model->loadCallBook($callsign, $this->config->item('use_fullname'));
140139

@@ -152,8 +151,8 @@ function json($tempcallsign, $temptype, $tempband, $tempmode, $tempstation_id =
152151
$return['qsl_manager'] = $this->nval($callbook['qslmgr'] ?? '', $this->logbook_model->call_qslvia($callsign));
153152
$return['callsign_state'] = $this->nval($callbook['state'] ?? '', $this->logbook_model->call_state($callsign));
154153
$return['callsign_us_county'] = $this->nval($callbook['us_county'] ?? '', $this->logbook_model->call_us_county($callsign));
155-
$return['workedBefore'] = $this->worked_grid_before($return['callsign_qra'], $type, $band, $mode);
156-
$return['confirmed'] = $this->confirmed_grid_before($return['callsign_qra'], $type, $band, $mode);
154+
$return['workedBefore'] = $this->worked_grid_before($return['callsign_qra'], $band, $mode);
155+
$return['confirmed'] = $this->confirmed_grid_before($return['callsign_qra'], $band, $mode);
157156
$return['timesWorked'] = $this->logbook_model->times_worked($lookupcall);
158157

159158
if ($this->session->userdata('user_show_profile_image')) {
@@ -201,7 +200,7 @@ function nval($val1, $val2) {
201200
return (($val2 ?? "") === "" ? ($val1 ?? "") : ($val2 ?? ""));
202201
}
203202

204-
function confirmed_grid_before($gridsquare, $type, $band, $mode) {
203+
function confirmed_grid_before($gridsquare, $band, $mode) {
205204
if (strlen($gridsquare) < 4)
206205
return false;
207206

@@ -235,7 +234,7 @@ function confirmed_grid_before($gridsquare, $type, $band, $mode) {
235234
}
236235

237236

238-
if($type == "SAT") {
237+
if($band == "SAT") {
239238
$this->db->where('COL_PROP_MODE', 'SAT');
240239
if ($extrawhere != '') {
241240
$this->db->where('('.$extrawhere.')');
@@ -270,7 +269,7 @@ function confirmed_grid_before($gridsquare, $type, $band, $mode) {
270269
return false;
271270
}
272271

273-
function worked_grid_before($gridsquare, $type, $band, $mode)
272+
function worked_grid_before($gridsquare, $band, $mode)
274273
{
275274
if (strlen($gridsquare) < 4)
276275
return false;
@@ -279,7 +278,7 @@ function worked_grid_before($gridsquare, $type, $band, $mode)
279278
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
280279

281280
if(!empty($logbooks_locations_array)) {
282-
if($type == "SAT") {
281+
if($band == "SAT") {
283282
$this->db->where('COL_PROP_MODE', 'SAT');
284283
} else {
285284
$this->db->where('COL_MODE', $this->logbook_model->get_main_mode_from_mode($mode));
@@ -625,7 +624,7 @@ function view($id) {
625624
$this->load->view('interface_assets/footer');
626625
}
627626

628-
function partial($id) {
627+
function partial($id, $band = null) {
629628
$this->load->model('user_model');
630629
if(!$this->user_model->authorize($this->config->item('auth_mode'))) { return; }
631630

@@ -879,7 +878,7 @@ function partial($id) {
879878

880879
if (isset($callsign['callsign']['gridsquare'])) {
881880
$this->load->model('logbook_model');
882-
$callsign['grid_worked'] = $this->logbook_model->check_if_grid_worked_in_logbook(strtoupper(substr($callsign['callsign']['gridsquare'],0,4)), 0, $this->session->userdata('user_default_band'))->num_rows();
881+
$callsign['grid_worked'] = $this->logbook_model->check_if_grid_worked_in_logbook(strtoupper(substr($callsign['callsign']['gridsquare'],0,4)), 0, $band)->num_rows();
883882
}
884883
if (isset($callsign['callsign']['error'])) {
885884
$callsign['error'] = $callsign['callsign']['error'];

assets/js/sections/contesting.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ $("#callsign").keyup(async function (e) {
300300
async function getCallbook() {
301301
var call = $("#callsign").val();
302302
if (call.length >= 3) {
303-
$.getJSON(base_url + 'index.php/logbook/json/' + call + '/0/'+$("#band").val()+'/'+$("#band").val() + '/' + current_active_location, function(result) {
303+
$.getJSON(base_url + 'index.php/logbook/json/' + call + '/'+$("#band").val()+'/'+$("#band").val() + '/' + current_active_location, function(result) {
304304
try {
305305
$('#bearing_info').html(result.bearing);
306306
} catch {}

assets/js/sections/qso.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -752,14 +752,11 @@ $( document ).ready(function() {
752752
$('.callsign-suggest').hide();
753753

754754
if($("#sat_name").val() != ""){
755-
var sat_type = "SAT";
756-
var json_band = "0";
757-
var json_mode = "0";
755+
var json_band = "SAT";
758756
} else {
759-
var sat_type = "0";
760757
var json_band = $("#band").val();
761-
var json_mode = $("#mode").val();
762758
}
759+
var json_mode = $("#mode").val();
763760

764761
var find_callsign = $(this).val().toUpperCase();
765762
var callsign = find_callsign;
@@ -768,7 +765,7 @@ $( document ).ready(function() {
768765
find_callsign=find_callsign.replace('Ø', '0');
769766

770767
// Replace / in a callsign with - to stop urls breaking
771-
$.getJSON(base_url + 'index.php/logbook/json/' + find_callsign + '/' + sat_type + '/' + json_band + '/' + json_mode + '/' + $('#stationProfile').val(), async function(result)
768+
$.getJSON(base_url + 'index.php/logbook/json/' + find_callsign + '/' + json_band + '/' + json_mode + '/' + $('#stationProfile').val(), async function(result)
772769
{
773770

774771
// Make sure the typed callsign and json result match

0 commit comments

Comments
 (0)