mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
Code adjustments
This commit is contained in:
@@ -213,13 +213,11 @@ class VUCC extends CI_Model
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
$inPlaceholders = str_repeat('?,', count($this->logbooks_locations_array) - 1) . '?';
|
$location_list = "'" . implode("','", $this->logbooks_locations_array) . "'";
|
||||||
$bindings = array_merge($this->logbooks_locations_array);
|
|
||||||
|
|
||||||
// Build band condition
|
// Build band condition
|
||||||
if ($band == 'SAT') {
|
if ($band == 'SAT') {
|
||||||
$bandCondition = " and col_prop_mode = ?";
|
$bandCondition = " and col_prop_mode = ?";
|
||||||
$bindings[] = $band;
|
|
||||||
} else {
|
} else {
|
||||||
$bandCondition = " and col_prop_mode != ? and col_band = ?";
|
$bandCondition = " and col_prop_mode != ? and col_band = ?";
|
||||||
$bindings[] = 'SAT';
|
$bindings[] = 'SAT';
|
||||||
@@ -230,7 +228,7 @@ class VUCC extends CI_Model
|
|||||||
// This is much more efficient than one query per grid
|
// This is much more efficient than one query per grid
|
||||||
$sql = "SELECT COL_CALL, col_gridsquare, col_vucc_grids
|
$sql = "SELECT COL_CALL, col_gridsquare, col_vucc_grids
|
||||||
FROM " . $this->config->item('table_name') . "
|
FROM " . $this->config->item('table_name') . "
|
||||||
WHERE station_id IN (" . $inPlaceholders . ")
|
WHERE station_id IN (" . $location_list . ")
|
||||||
AND (col_gridsquare <> '' OR col_vucc_grids <> '')"
|
AND (col_gridsquare <> '' OR col_vucc_grids <> '')"
|
||||||
. $bandCondition;
|
. $bandCondition;
|
||||||
|
|
||||||
@@ -287,14 +285,11 @@ class VUCC extends CI_Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
$results = ['gridsquare' => [], 'vucc_grids' => []];
|
$results = ['gridsquare' => [], 'vucc_grids' => []];
|
||||||
$inPlaceholders = str_repeat('?,', count($this->logbooks_locations_array) - 1) . '?';
|
|
||||||
|
|
||||||
// Query 1: Get col_gridsquare data for the band
|
$location_list = "'" . implode("','", $this->logbooks_locations_array) . "'";
|
||||||
$bindings1 = array_merge($this->logbooks_locations_array);
|
|
||||||
|
|
||||||
if ($band == 'SAT') {
|
if ($band == 'SAT') {
|
||||||
$bandCondition1 = " and log.col_prop_mode = ?";
|
$bandCondition1 = " and log.col_prop_mode = ?";
|
||||||
$bindings1[] = $band;
|
|
||||||
} else {
|
} else {
|
||||||
$bandCondition1 = " and log.col_prop_mode != ? and log.col_band = ?";
|
$bandCondition1 = " and log.col_prop_mode != ? and log.col_band = ?";
|
||||||
$bindings1[] = 'SAT';
|
$bindings1[] = 'SAT';
|
||||||
@@ -307,7 +302,7 @@ class VUCC extends CI_Model
|
|||||||
MAX(CASE WHEN col_lotw_qsl_rcvd='Y' THEN 1 ELSE 0 END) as lotw_confirmed,
|
MAX(CASE WHEN col_lotw_qsl_rcvd='Y' THEN 1 ELSE 0 END) as lotw_confirmed,
|
||||||
MAX(CASE WHEN (col_qsl_rcvd='Y' OR col_lotw_qsl_rcvd='Y') THEN 1 ELSE 0 END) as confirmed
|
MAX(CASE WHEN (col_qsl_rcvd='Y' OR col_lotw_qsl_rcvd='Y') THEN 1 ELSE 0 END) as confirmed
|
||||||
FROM " . $this->config->item('table_name') . " log
|
FROM " . $this->config->item('table_name') . " log
|
||||||
WHERE log.station_id IN (" . $inPlaceholders . ")
|
WHERE log.station_id IN (" . $location_list . ")
|
||||||
AND log.col_gridsquare <> ''"
|
AND log.col_gridsquare <> ''"
|
||||||
. $bandCondition1 . "
|
. $bandCondition1 . "
|
||||||
GROUP BY UPPER(SUBSTRING(col_gridsquare, 1, 4))";
|
GROUP BY UPPER(SUBSTRING(col_gridsquare, 1, 4))";
|
||||||
@@ -317,9 +312,6 @@ class VUCC extends CI_Model
|
|||||||
$results['gridsquare'] = $query1->result_array();
|
$results['gridsquare'] = $query1->result_array();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Query 2: Get col_vucc_grids data for the band
|
|
||||||
$bindings2 = array_merge($this->logbooks_locations_array);
|
|
||||||
|
|
||||||
if ($band == 'SAT') {
|
if ($band == 'SAT') {
|
||||||
$bandCondition2 = " and col_prop_mode = ?";
|
$bandCondition2 = " and col_prop_mode = ?";
|
||||||
$bindings2[] = $band;
|
$bindings2[] = $band;
|
||||||
@@ -335,7 +327,7 @@ class VUCC extends CI_Model
|
|||||||
MAX(CASE WHEN col_lotw_qsl_rcvd='Y' THEN 1 ELSE 0 END) as lotw_confirmed,
|
MAX(CASE WHEN col_lotw_qsl_rcvd='Y' THEN 1 ELSE 0 END) as lotw_confirmed,
|
||||||
MAX(CASE WHEN (col_qsl_rcvd='Y' OR col_lotw_qsl_rcvd='Y') THEN 1 ELSE 0 END) as confirmed
|
MAX(CASE WHEN (col_qsl_rcvd='Y' OR col_lotw_qsl_rcvd='Y') THEN 1 ELSE 0 END) as confirmed
|
||||||
FROM " . $this->config->item('table_name') . "
|
FROM " . $this->config->item('table_name') . "
|
||||||
WHERE station_id IN (" . $inPlaceholders . ")
|
WHERE station_id IN (" . $location_list . ")
|
||||||
AND col_vucc_grids <> ''"
|
AND col_vucc_grids <> ''"
|
||||||
. $bandCondition2 . "
|
. $bandCondition2 . "
|
||||||
GROUP BY col_vucc_grids";
|
GROUP BY col_vucc_grids";
|
||||||
|
|||||||
Reference in New Issue
Block a user