From b9730379fb15008b573b5a4be21d64ebbc426dcd Mon Sep 17 00:00:00 2001 From: Andreas Kristiansen <6977712+AndreasK79@users.noreply.github.com> Date: Tue, 30 Jul 2024 15:40:05 +0200 Subject: [PATCH] Changed to use contest name in Cabrillo export, if available --- application/models/Contesting_model.php | 19 ++++++++++--------- assets/js/sections/cabrillo.js | 12 ++++++------ 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/application/models/Contesting_model.php b/application/models/Contesting_model.php index 48c9b0a54..60358bcb7 100644 --- a/application/models/Contesting_model.php +++ b/application/models/Contesting_model.php @@ -265,8 +265,8 @@ class Contesting_model extends CI_Model { $station_id = $this->Stations->find_active(); $sql = "select col_contest_id, min(date(col_time_on)) mindate, max(date(col_time_on)) maxdate, year(col_time_on) year, month(col_time_on) month - from " . $this->config->item('table_name') . " - where coalesce(COL_CONTEST_ID, '') <> '' + from " . $this->config->item('table_name') . " + where coalesce(COL_CONTEST_ID, '') <> '' and station_id =" . $station_id; $sql .= " group by COL_CONTEST_ID , year(col_time_on), month(col_time_on) order by year(col_time_on) desc"; @@ -279,8 +279,8 @@ class Contesting_model extends CI_Model { function get_logged_years($station_id) { $sql = "select distinct year(col_time_on) year - from " . $this->config->item('table_name') . " - where coalesce(COL_CONTEST_ID, '') <> '' + from " . $this->config->item('table_name') . " + where coalesce(COL_CONTEST_ID, '') <> '' and station_id =" . $station_id; $sql .= " order by year(col_time_on) desc"; @@ -291,9 +291,10 @@ class Contesting_model extends CI_Model { } function get_logged_contests($station_id, $year) { - $sql = "select distinct col_contest_id - from " . $this->config->item('table_name') . " - where coalesce(COL_CONTEST_ID, '') <> '' + $sql = "select distinct col_contest_id, coalesce(contest.name, col_contest_id) contestname + from " . $this->config->item('table_name') . " thcv + left outer join contest on thcv.col_contest_id = contest.adifname + where coalesce(COL_CONTEST_ID, '') <> '' and station_id =" . $station_id . " and year(col_time_on) ='" . $year . "'"; @@ -306,8 +307,8 @@ class Contesting_model extends CI_Model { function get_contest_dates($station_id, $year, $contestid) { $sql = "select distinct (date(col_time_on)) date - from " . $this->config->item('table_name') . " - where coalesce(COL_CONTEST_ID, '') <> '' + from " . $this->config->item('table_name') . " + where coalesce(COL_CONTEST_ID, '') <> '' and station_id =" . $station_id . " and year(col_time_on) ='" . $year . "' and col_contest_id ='" . $contestid . "'"; diff --git a/assets/js/sections/cabrillo.js b/assets/js/sections/cabrillo.js index 97685dc34..5e5ffcf4d 100644 --- a/assets/js/sections/cabrillo.js +++ b/assets/js/sections/cabrillo.js @@ -12,7 +12,7 @@ function loadYears() { $(".contestyear").append('
' + lang_export_cabrillo_select_year + '
' + '' + - ' '); + ' '); $.each(data, function(key, value) { $('#year') @@ -40,13 +40,13 @@ function loadContests() { $(".contestname").append('
' + lang_export_cabrillo_select_contest + '
' + '' + - ' '); + ' '); $.each(data, function(key, value) { $('#contestid') .append($("") .attr("value",value.col_contest_id) - .text(value.col_contest_id)); + .text(value.contestname)); }); } }); @@ -66,7 +66,7 @@ function loadContestDates() { '' + '' + - ' '); + ' '); $.each(data, function(key, value) { $('#contestdatesfrom') @@ -75,7 +75,7 @@ function loadContestDates() { .text(value.date)); }); - + $.each(data, function(key, value) { $('#contestdatesto') .append($("") @@ -88,4 +88,4 @@ function loadContestDates() { function addAdditionalInfo() { $(".additionalinfo").removeAttr("hidden"); -} \ No newline at end of file +}