Fixed a couple of bugs in countries breakdown on dashboard.

这个提交包含在:
Andreas 2020-10-16 20:02:54 +02:00
父节点 93730f37e7
当前提交 68c8b3889c
共有 4 个文件被更改,包括 59 次插入18 次删除

查看文件

@ -50,10 +50,10 @@ class Dashboard extends CI_Controller {
$data['month_qsos'] = $this->logbook_model->month_qsos();
$data['year_qsos'] = $this->logbook_model->year_qsos();
$data['total_countrys'] = $this->logbook_model->total_countrys();
$data['total_countrys_confirmed_paper'] = $this->logbook_model->total_countrys_confirmed_paper();
$data['total_countrys_confirmed_eqsl'] = $this->logbook_model->total_countrys_confirmed_eqsl();
$data['total_countrys_confirmed_lotw'] = $this->logbook_model->total_countrys_confirmed_lotw();
$data['total_countries'] = $this->logbook_model->total_countries();
$data['total_countries_confirmed_paper'] = $this->logbook_model->total_countries_confirmed_paper();
$data['total_countries_confirmed_eqsl'] = $this->logbook_model->total_countries_confirmed_eqsl();
$data['total_countries_confirmed_lotw'] = $this->logbook_model->total_countries_confirmed_lotw();
$data['total_qsl_sent'] = $this->logbook_model->total_qsl_sent();
$data['total_qsl_recv'] = $this->logbook_model->total_qsl_recv();
@ -63,6 +63,13 @@ class Dashboard extends CI_Controller {
$data['page_title'] = "Dashboard";
$this->load->model('dxcc');
$dxcc = $this->dxcc->list_current();
$current = $this->logbook_model->total_countries_current();
$data['total_countries_needed'] = count($dxcc->result()) - $current;
$this->load->view('interface_assets/header', $data);
$this->load->view('dashboard/index');
$this->load->view('interface_assets/footer');

查看文件

@ -168,11 +168,23 @@ class DXCC extends CI_Model {
$this->db->empty_table($table);
}
/*
* Fethes a list of all dxcc's, both current and deleted
*/
function list() {
$this->db->order_by('name', 'ASC');
return $this->db->get('dxcc_entities');
}
/*
* Fetches a list of all current dxcc's (non-deleted)
*/
function list_current() {
$this->db->where('end', null);
$this->db->order_by('name', 'ASC');
return $this->db->get('dxcc_entities');
}
function get_dxcc_array($dxccArray, $bands, $postdata) {
$CI =& get_instance();
$CI->load->model('Stations');

查看文件

@ -1226,19 +1226,41 @@ class Logbook_model extends CI_Model {
}
}
/* Return total number of countrys worked */
function total_countrys() {
/* Return total number of countries worked */
function total_countries() {
$CI =& get_instance();
$CI->load->model('Stations');
$station_id = $CI->Stations->find_active();
$query = $this->db->query('SELECT DISTINCT (COL_COUNTRY) FROM '.$this->config->item('table_name').' WHERE COL_COUNTRY != "Invalid" AND station_id = '.$station_id.'');
$sql = 'SELECT DISTINCT (COL_COUNTRY) FROM '.$this->config->item('table_name').'
WHERE COL_COUNTRY != "Invalid"
AND col_dxcc > 0
AND station_id = '.$station_id ;
$query = $this->db->query($sql);
return $query->num_rows();
}
/* Return total number of countrys confirmed with paper QSL */
function total_countrys_confirmed_paper() {
/* Return total number of countries worked */
function total_countries_current() {
$CI =& get_instance();
$CI->load->model('Stations');
$station_id = $CI->Stations->find_active();
$sql = 'SELECT DISTINCT (COL_COUNTRY) FROM '.$this->config->item('table_name').' thcv
join dxcc_entities on thcv.col_dxcc = dxcc_entities.adif
WHERE COL_COUNTRY != "Invalid"
AND dxcc_entities.end is null
AND station_id = '.$station_id;
$query = $this->db->query($sql);
return $query->num_rows();
}
/* Return total number of countries confirmed with paper QSL */
function total_countries_confirmed_paper() {
$CI =& get_instance();
$CI->load->model('Stations');
$station_id = $CI->Stations->find_active();
@ -1248,8 +1270,8 @@ class Logbook_model extends CI_Model {
return $query->num_rows();
}
/* Return total number of countrys confirmed with eQSL */
function total_countrys_confirmed_eqsl() {
/* Return total number of countries confirmed with eQSL */
function total_countries_confirmed_eqsl() {
$CI =& get_instance();
$CI->load->model('Stations');
$station_id = $CI->Stations->find_active();
@ -1259,8 +1281,8 @@ class Logbook_model extends CI_Model {
return $query->num_rows();
}
/* Return total number of countrys confirmed with LoTW */
function total_countrys_confirmed_lotw() {
/* Return total number of countries confirmed with LoTW */
function total_countries_confirmed_lotw() {
$CI =& get_instance();
$CI->load->model('Stations');
$station_id = $CI->Stations->find_active();

查看文件

@ -119,20 +119,20 @@
<tr>
<td><?php echo $this->lang->line('general_word_worked'); ?></td>
<td><?php echo $total_countrys; ?></td>
<td><?php echo $total_countries; ?></td>
</tr>
<tr>
<td><a href="#" onclick="return false" data-original-title="QSL Cards / eQSL / LoTW" data-toggle="tooltip"><?php echo $this->lang->line('general_word_confirmed'); ?></a></td>
<td>
<?php echo $total_countrys_confirmed_paper; ?> /
<?php echo $total_countrys_confirmed_eqsl; ?> /
<?php echo $total_countrys_confirmed_lotw; ?>
<?php echo $total_countries_confirmed_paper; ?> /
<?php echo $total_countries_confirmed_eqsl; ?> /
<?php echo $total_countries_confirmed_lotw; ?>
</td>
</tr>
<tr>
<td><?php echo $this->lang->line('general_word_needed'); ?></td>
<td><?php $dxcc = 340 - $total_countrys; echo $dxcc; ?></td>
<td><?php echo $total_countries_needed; ?></td>
</tr>
</table>