kopia lustrzana https://github.com/magicbug/Cloudlog
[Advance Search] Remove duplicate modes
Think this handles sub modes correctly now although you still see USB / LSB listed if its in the main MODE window. not sure whether to make a migration to change those.pull/1874/head
rodzic
54c31a6b3f
commit
e16e7ed18a
|
@ -35,18 +35,18 @@ class Logbookadvanced extends CI_Controller {
|
|||
}
|
||||
ksort($deOptions);
|
||||
$deOptions = array_keys($deOptions);
|
||||
|
||||
$modes = [];
|
||||
if ($stationIds !== []) {
|
||||
foreach ($this->logbookadvanced_model->get_worked_modes($stationIds) as $mode) {
|
||||
$key = $mode['mode'];
|
||||
if ($mode['submode'] !== null) {
|
||||
if ($mode['submode'] != null) {
|
||||
$key .= "|" . $mode['submode'];
|
||||
}
|
||||
|
||||
if ($mode['submode'] == null) {
|
||||
$modes[$key] = $mode['mode'];
|
||||
} else {
|
||||
$modes[$key] = $mode['submode'];
|
||||
$modes[$key] = $mode['mode'] . " | ".$mode['submode'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ class Logbookadvanced_model extends CI_Model {
|
|||
$ids = "'".implode("','",$stationIds)."'";
|
||||
|
||||
$sql = "
|
||||
SELECT distinct `COL_MODE`, `COL_SUBMODE`
|
||||
SELECT distinct COL_MODE, COL_SUBMODE
|
||||
FROM `" . $this->config->item('table_name') . "` qsos
|
||||
WHERE qsos.station_id IN (".$ids.")
|
||||
ORDER BY COL_MODE, COL_SUBMODE";
|
||||
|
@ -23,11 +23,24 @@ class Logbookadvanced_model extends CI_Model {
|
|||
|
||||
$results = [];
|
||||
foreach ($data->result() as $row) {
|
||||
$results[] = [
|
||||
'mode' => $row->COL_MODE,
|
||||
'submode' => $row->COL_SUBMODE
|
||||
];
|
||||
if(!empty($row->COL_SUBMODE)) {
|
||||
$results[] = [
|
||||
'mode' => $row->COL_MODE,
|
||||
'submode' => $row->COL_SUBMODE
|
||||
];
|
||||
} else {
|
||||
// if mode is not already in the results array
|
||||
if (!in_array($row->COL_MODE, array_column($results, 'mode'))) {
|
||||
$results[] = [
|
||||
'mode' => $row->COL_MODE,
|
||||
'submode' => null
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue