[CQ Award] Added filtering to the summary

这个提交包含在:
Andreas 2022-01-06 19:35:08 +01:00
父节点 195f025e3b
当前提交 1bedfbb919
共有 3 个文件被更改,包括 19 次插入11 次删除

查看文件

@ -278,7 +278,7 @@ class Awards extends CI_Controller {
if ($logbooks_locations_array) { if ($logbooks_locations_array) {
$location_list = "'".implode("','",$logbooks_locations_array)."'"; $location_list = "'".implode("','",$logbooks_locations_array)."'";
$data['cq_array'] = $this->cq->get_cq_array($bands, $postdata, $location_list); $data['cq_array'] = $this->cq->get_cq_array($bands, $postdata, $location_list);
$data['cq_summary'] = $this->cq->get_cq_summary($data['worked_bands'], $location_list); $data['cq_summary'] = $this->cq->get_cq_summary($bands, $postdata, $location_list);
} else { } else {
$location_list = null; $location_list = null;
$data['cq_array'] = null; $data['cq_array'] = null;

查看文件

@ -162,16 +162,16 @@ class CQ extends CI_Model{
/* /*
* Function gets worked and confirmed summary on each band on the active stationprofile * Function gets worked and confirmed summary on each band on the active stationprofile
*/ */
function get_cq_summary($bands, $location_list) { function get_cq_summary($bands, $postdata, $location_list) {
foreach ($bands as $band) { foreach ($bands as $band) {
$worked = $this->getSummaryByBand($band, $location_list); $worked = $this->getSummaryByBand($band, $postdata, $location_list);
$confirmed = $this->getSummaryByBandConfirmed($band, $location_list); $confirmed = $this->getSummaryByBandConfirmed($band, $postdata, $location_list);
$cqSummary['worked'][$band] = $worked[0]->count; $cqSummary['worked'][$band] = $worked[0]->count;
$cqSummary['confirmed'][$band] = $confirmed[0]->count; $cqSummary['confirmed'][$band] = $confirmed[0]->count;
} }
$workedTotal = $this->getSummaryByBand('All', $location_list); $workedTotal = $this->getSummaryByBand($postdata['band'], $postdata, $location_list);
$confirmedTotal = $this->getSummaryByBandConfirmed('All', $location_list); $confirmedTotal = $this->getSummaryByBandConfirmed($postdata['band'], $postdata, $location_list);
$cqSummary['worked']['Total'] = $workedTotal[0]->count; $cqSummary['worked']['Total'] = $workedTotal[0]->count;
$cqSummary['confirmed']['Total'] = $confirmedTotal[0]->count; $cqSummary['confirmed']['Total'] = $confirmedTotal[0]->count;
@ -179,7 +179,7 @@ class CQ extends CI_Model{
return $cqSummary; return $cqSummary;
} }
function getSummaryByBand($band, $location_list) { function getSummaryByBand($band, $postdata, $location_list) {
$sql = "SELECT count(distinct thcv.col_cqz) as count FROM " . $this->config->item('table_name') . " thcv"; $sql = "SELECT count(distinct thcv.col_cqz) as count FROM " . $this->config->item('table_name') . " thcv";
$sql .= " where station_id in (" . $location_list . ') and col_cqz > 0'; $sql .= " where station_id in (" . $location_list . ') and col_cqz > 0';
@ -191,14 +191,18 @@ class CQ extends CI_Model{
} else { } else {
$sql .= " and thcv.col_prop_mode !='SAT'"; $sql .= " and thcv.col_prop_mode !='SAT'";
$sql .= " and thcv.col_band ='" . $band . "'"; $sql .= " and thcv.col_band ='" . $band . "'";
} }
if ($postdata['mode'] != 'All') {
$sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')";
}
$query = $this->db->query($sql); $query = $this->db->query($sql);
return $query->result(); return $query->result();
} }
function getSummaryByBandConfirmed($band, $location_list){ function getSummaryByBandConfirmed($band, $postdata, $location_list){
$sql = "SELECT count(distinct thcv.col_cqz) as count FROM " . $this->config->item('table_name') . " thcv"; $sql = "SELECT count(distinct thcv.col_cqz) as count FROM " . $this->config->item('table_name') . " thcv";
$sql .= " where station_id in (" . $location_list . ') and col_cqz > 0'; $sql .= " where station_id in (" . $location_list . ') and col_cqz > 0';
@ -212,7 +216,11 @@ class CQ extends CI_Model{
$sql .= " and thcv.col_band ='" . $band . "'"; $sql .= " and thcv.col_band ='" . $band . "'";
} }
$sql .= " and (col_qsl_rcvd = 'Y' or col_lotw_qsl_rcvd = 'Y')"; if ($postdata['mode'] != 'All') {
$sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')";
}
$sql .= $this->addQslToQuery($postdata);
$query = $this->db->query($sql); $query = $this->db->query($sql);

查看文件

@ -192,7 +192,7 @@
<thead> <thead>
<tr><td></td>'; <tr><td></td>';
foreach($worked_bands as $band) { foreach($bands as $band) {
echo '<td>' . $band . '</td>'; echo '<td>' . $band . '</td>';
} }
echo '<td>Total</td></tr> echo '<td>Total</td></tr>