[Accumulated Statistics] Fixed when no QSOs found.

这个提交包含在:
Andreas 2021-11-14 17:33:24 +01:00
父节点 e257ffa109
当前提交 9e4c97e45b
共有 2 个文件被更改,包括 105 次插入93 次删除

查看文件

@ -8,6 +8,10 @@ class Accumulate_model extends CI_Model
$CI->load->model('logbooks_model'); $CI->load->model('logbooks_model');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
if (!$logbooks_locations_array) {
return array();
}
$location_list = "'".implode("','",$logbooks_locations_array)."'"; $location_list = "'".implode("','",$logbooks_locations_array)."'";
switch ($award) { switch ($award) {

查看文件

@ -9,15 +9,22 @@ function accumulatePlot(form) {
var mode = form.mode.value; var mode = form.mode.value;
var period = form.periodradio.value; var period = form.periodradio.value;
$.ajax({ $.ajax({
url: base_url+'index.php/accumulated/get_accumulated_data', url: base_url + 'index.php/accumulated/get_accumulated_data',
type: 'post', type: 'post',
data: {'Band': form.band.value, 'Award': award, 'Mode': mode, 'Period': period}, data: { 'Band': form.band.value, 'Award': award, 'Mode': mode, 'Period': period },
success: function(data) { success: function (data) {
if (!$.trim(data)) {
$("#accumulateContainer").empty();
$("#accumulateContainer").append('<div class="alert alert-danger" role="alert"><a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>Nothing found!</div>');
$(".ld-ext-right").removeClass('running');
$(".ld-ext-right").prop('disabled', false);
}
else {
// used for switching award text in the table and the chart // used for switching award text in the table and the chart
switch(award) { switch (award) {
case 'dxcc': var awardtext = "DXCC\'s"; break; case 'dxcc': var awardtext = "DXCC\'s"; break;
case 'was': var awardtext = "states";break; case 'was': var awardtext = "states"; break;
case 'iota': var awardtext = "IOTA\'s";break; case 'iota': var awardtext = "IOTA\'s"; break;
case 'waz': var awardtext = "CQ zones"; break; case 'waz': var awardtext = "CQ zones"; break;
} }
@ -34,7 +41,7 @@ function accumulatePlot(form) {
'<tr>' + '<tr>' +
'<td>#</td>' + '<td>#</td>' +
'<td>' + periodtext + '</td>' + '<td>' + periodtext + '</td>' +
'<td>Accumulated # of ' + awardtext + ' worked </td>'+ '<td>Accumulated # of ' + awardtext + ' worked </td>' +
'</tr>' + '</tr>' +
'</thead>' + '</thead>' +
'<tbody></tbody></table>'); '<tbody></tbody></table>');
@ -45,7 +52,7 @@ function accumulatePlot(form) {
var i = 1; var i = 1;
// building the rows in the table // building the rows in the table
var rowElements = data.map(function ( row ) { var rowElements = data.map(function (row) {
var $row = $('<tr></tr>'); var $row = $('<tr></tr>');
@ -61,7 +68,7 @@ function accumulatePlot(form) {
// finally inserting the rows // finally inserting the rows
$myTable.append(rowElements); $myTable.append(rowElements);
$.each(data, function(){ $.each(data, function () {
labels.push(this.year); labels.push(this.year);
dataDxcc.push(this.total); dataDxcc.push(this.total);
}); });
@ -83,7 +90,7 @@ function accumulatePlot(form) {
scales: { scales: {
yAxes: [{ yAxes: [{
ticks: { ticks: {
beginAtZero:true, beginAtZero: true,
fontColor: color fontColor: color
} }
}], }],
@ -116,11 +123,12 @@ function accumulatePlot(form) {
}); });
// using this to change color of csv-button if dark mode is chosen // using this to change color of csv-button if dark mode is chosen
var background = $('body').css( "background-color"); var background = $('body').css("background-color");
if (background != ('rgb(255, 255, 255)')) { if (background != ('rgb(255, 255, 255)')) {
$(".buttons-csv").css("color", "white"); $(".buttons-csv").css("color", "white");
} }
} }
}
}); });
} }