Continent update is fixed

This commit is contained in:
Andreas Kristiansen
2025-12-13 20:45:37 +01:00
parent 3d0949cbdc
commit 82fbbb84f9
5 changed files with 46 additions and 35 deletions

View File

@@ -1397,7 +1397,8 @@ class Logbookadvanced_model extends CI_Model {
JOIN dxcc_entities ON " . $this->config->item('table_name') . ".col_dxcc = dxcc_entities.adif
JOIN station_profile on " . $this->config->item('table_name') . ".station_id = station_profile.station_id
SET col_cont = dxcc_entities.cont
WHERE COALESCE(" . $this->config->item('table_name') . ".col_cont, '') = '' and station_profile.user_id = ?";
WHERE (COALESCE(" . $this->config->item('table_name') . ".col_cont, '') = '' or " . $this->config->item('table_name') . ".col_cont not in ('AF', 'AN', 'AS', 'EU', 'NA', 'OC', 'SA'))
and station_profile.user_id = ?";
$query = $this->db->query($sql, array($this->session->userdata('user_id')));
$result = $this->db->affected_rows();
@@ -1480,7 +1481,10 @@ class Logbookadvanced_model extends CI_Model {
$sql = "select count(*) as count from " . $this->config->item('table_name') . "
join station_profile on " . $this->config->item('table_name') . ".station_id = station_profile.station_id
where user_id = ?
and (coalesce(col_cont, '') = '' or col_cont not in ('AF', 'AN', 'AS', 'EU', 'NA', 'OC', 'SA'))";
and (coalesce(col_cont, '') = '' or col_cont not in ('AF', 'AN', 'AS', 'EU', 'NA', 'OC', 'SA'))
and col_dxcc is not null
and col_dxcc != ''
and col_dxcc != 0";
$bindings[] = [$this->session->userdata('user_id')];

View File

@@ -28,7 +28,7 @@ function check_missing_distance($result) { ?>
<?= __("Update all QSOs with the distance based on your gridsquare set in the station profile, and the gridsquare of the QSO partner. Distance will be calculated based on if short path or long path is set."); ?>
<?= __("This is useful if you have imported QSOs without distance information."); ?><br /><br />
<?= __("Update will only set the distance for QSOs where the distance is empty."); ?>
<br/>
<br />
<button type="button" class="mt-2 btn btn-sm btn-primary ld-ext-right" id="updateDistancesBtn" onclick="runUpdateDistancesFix('')">
<?= __("Update now") ?><div class="ld ld-ring ld-spin"></div>
</button>
@@ -39,8 +39,13 @@ function check_qsos_missing_continent($result) { ?>
<h5>Continent Check Results</h5>
QSOs to update found: <?php echo $result[0]->count; ?>
<br/>
<button type="button" class="mt-2 btn btn-sm btn-primary ld-ext-right" id="updateDistancesBtn" onclick="fixMissingDxcc('All')">
<?= __("Run fix") ?><div class="ld ld-ring ld-spin"></div>
<br/>
<?= __("Update all QSOs with the continent based on the DXCC country of the QSO."); ?>
<?= __("This is useful if you have imported QSOs without continent information."); ?><br /><br />
<?= __("Update will only set the continent for QSOs where the continent is empty."); ?>
<br />
<button type="button" class="mt-2 btn btn-sm btn-primary ld-ext-right" id="updateDistancesBtn" onclick="runContinentFix('')">
<?= __("Update now") ?><div class="ld ld-ring ld-spin"></div>
</button>
<?php }

View File

@@ -46,7 +46,7 @@
<div class="list-group-item d-flex justify-content-between align-items-center">
<div>
<h6 class="mb-1"><?= __("Fix State") ?></h6>
<p class="mb-1 small text-muted"><?= __("Update missing or incorrect state/province information") ?></p>
<p class="mb-1 small text-muted"><?= __("Update missing state/province information") ?></p>
</div>
<div class="d-flex nowrap">
<button type="button" class="btn btn-sm btn-secondary me-1 ld-ext-right" id="checkFixStateBtn" onclick="checkFixState()">

View File

@@ -770,9 +770,7 @@ $options = json_decode($options);
<button type="button" class="btn btn-sm btn-info dropdown-action" id="qslSlideshow"><?= __("QSL Slideshow"); ?></button>
<button type="button" class="btn btn-sm btn-success dropdown-action" id="fixCqZones"><?= __("Fix CQ Zones"); ?></button>
<button type="button" class="btn btn-sm btn-success dropdown-action" id="fixItuZones"><?= __("Fix ITU Zones"); ?></button>
<button type="button" class="btn btn-sm btn-success dropdown-action" id="fixContinent"><?= __("Fix Continent"); ?></button>
<button type="button" class="btn btn-sm btn-success dropdown-action" id="fixState"><?= __("Fix State"); ?></button>
<button type="button" class="btn btn-sm btn-success dropdown-action" id="updateDistances"><?= __("Update Distances"); ?></button>
<button type="button" class="btn btn-sm btn-success dropdown-action" id="dbtools"><?= __("Database Tools"); ?></button>
</div>
</div>

View File

@@ -1275,33 +1275,6 @@ $(document).ready(function () {
});
});
function runContinentFix(dialogItself) {
$('#updateContinentButton').prop("disabled", true).addClass("running");
$('#closeButton').prop("disabled", true);
$.ajax({
url: base_url + 'index.php/logbookadvanced/fixContinent',
type: 'POST',
success: function (response) {
$('#updateContinentButton').prop("disabled", false).removeClass("running");
dialogItself.close();
BootstrapDialog.alert({
title: lang_gen_advanced_logbook_success,
message: lang_gen_advanced_logbook_continents_updated + ' ' + response + ' ' + lang_gen_advanced_logbook_records_updated,
type: BootstrapDialog.TYPE_SUCCESS
});
},
error: function () {
$('#updateContinentButton').prop("disabled", false).removeClass("running");
dialogItself.close();
BootstrapDialog.alert({
title: lang_gen_advanced_logbook_error,
message: lang_gen_advanced_logbook_problem_fixing_continents,
type: BootstrapDialog.TYPE_DANGER
});
}
});
}
$('#updateDistances').click(function (event) {
$.ajax({
url: base_url + 'index.php/logbookadvanced/distanceDialog',
@@ -2396,3 +2369,34 @@ function saveOptions() {
}
});
}
function runContinentFix(dialogItself) {
$('#updateContinentButton').prop("disabled", true).addClass("running");
$('#closeButton').prop("disabled", true);
$.ajax({
url: base_url + 'index.php/logbookadvanced/fixContinent',
type: 'POST',
success: function (response) {
$('#updateContinentButton').prop("disabled", false).removeClass("running");
if (dialogItself != '') {
dialogItself.close();
}
BootstrapDialog.alert({
title: lang_gen_advanced_logbook_success,
message: lang_gen_advanced_logbook_continents_updated + ' ' + response + ' ' + lang_gen_advanced_logbook_records_updated,
type: BootstrapDialog.TYPE_SUCCESS
});
},
error: function () {
$('#updateContinentButton').prop("disabled", false).removeClass("running");
if (dialogItself != '') {
dialogItself.close();
}
BootstrapDialog.alert({
title: lang_gen_advanced_logbook_error,
message: lang_gen_advanced_logbook_problem_fixing_continents,
type: BootstrapDialog.TYPE_DANGER
});
}
});
}