Merge pull request #3036 from AndreasK79/itu_award_band_without_sat

[ITU Award] Split bands and sat
This commit is contained in:
Andreas Kristiansen
2026-03-05 08:39:50 +01:00
committed by GitHub
3 changed files with 101 additions and 79 deletions

View File

@@ -17,6 +17,9 @@ class ITU extends CI_Model{
// Initialize all bands to dash
foreach ($bands as $band) {
if (($postdata['band'] != 'SAT') && ($band == 'SAT')) {
continue;
}
for ($i = 1; $i <= 90; $i++) {
$bandItu[$i][$band] = '-'; // Sets all to dash to indicate no result
}
@@ -24,6 +27,9 @@ class ITU extends CI_Model{
// Initialize summary counters only for the bands passed in
foreach ($bands as $band) {
if (($postdata['band'] != 'SAT') && ($band == 'SAT')) {
continue;
}
$summary['worked'][$band] = 0;
$summary['confirmed'][$band] = 0;
}
@@ -80,8 +86,10 @@ class ITU extends CI_Model{
$summary['confirmed'][$itu->col_band]++;
}
} else {
if ($postdata['worked'] != NULL) {
$bandItu[$itu->col_ituz][$itu->col_band] = '<div class="bg-danger awardsBgWarning"><a href=\'javascript:displayContacts("' . str_replace("&", "%26", $itu->col_ituz) . '","' . $itu->col_band . '","All", "All","'. $postdata['mode'] . '","ITUZone","")\'>W</a></div>';
}
}
// Track worked zones for summary
if (!isset($workedZones[$itu->col_band][$itu->col_ituz])) {
@@ -90,7 +98,11 @@ class ITU extends CI_Model{
}
}
if ($postdata['band'] == 'SAT') {
foreach ($itudata_sat as $itu) {
if (($postdata['band'] != 'SAT') && ($band == 'SAT')) {
continue;
}
// Skip if this band is not in our requested bands list
if (!isset($validBands[$itu->col_band])) {
continue;
@@ -130,8 +142,10 @@ class ITU extends CI_Model{
$summary['confirmed'][$itu->col_band]++;
}
} else {
if ($postdata['worked'] != NULL) {
$bandItu[$itu->col_ituz][$itu->col_band] = '<div class="bg-danger awardsBgWarning"><a href=\'javascript:displayContacts("' . str_replace("&", "%26", $itu->col_ituz) . '","' . $itu->col_band . '","All", "All","'. $postdata['mode'] . '","ITUZone","")\'>W</a></div>';
}
}
// Track worked zones for summary
if (!isset($workedZones[$itu->col_band][$itu->col_ituz])) {
@@ -139,30 +153,31 @@ class ITU extends CI_Model{
$summary['worked'][$itu->col_band]++;
}
}
}
// Calculate totals across all bands (excluding SAT)
$totalWorkedZones = [];
$totalConfirmedZones = [];
foreach ($workedZones as $band => $zones) {
// Skip SAT for totals
if ($band === 'SAT') {
continue;
}
foreach ($zones as $zone => $true) {
if (!isset($totalWorkedZones[$zone])) {
$totalWorkedZones[$zone] = true;
if ($band === 'SAT') {
continue;
}
$totalWorkedZonesExSat[$zone] = true; // For calculating total worked excluding SAT
$summary['worked']['Total']++;
}
}
}
foreach ($confirmedZones as $band => $zones) {
// Skip SAT for totals
if ($band === 'SAT') {
continue;
}
foreach ($zones as $zone => $true) {
if (!isset($totalConfirmedZones[$zone])) {
$totalConfirmedZones[$zone] = true;
if ($band === 'SAT') {
continue;
}
$totalConfirmedZonesExSat[$zone] = true; // For calculating total worked excluding SAT
$summary['confirmed']['Total']++;
}
}
@@ -204,9 +219,9 @@ class ITU extends CI_Model{
}
} else {
for ($i = 1; $i <= 90; $i++) {
if (isset($totalConfirmedZones[$i])) {
if (isset($totalConfirmedZonesExSat[$i])) {
$mapZones[$i-1] = 'C'; // Confirmed
} else if (isset($totalWorkedZones[$i])) {
} else if (isset($totalWorkedZonesExSat[$i])) {
$mapZones[$i-1] = 'W'; // Worked but not confirmed
} else {
$mapZones[$i-1] = '-'; // Not worked

View File

@@ -556,6 +556,16 @@ class Logbook_model extends CI_Model {
break;
case 'ITU':
$this->db->where('COL_ITUZ', $searchphrase);
if ($band == 'SAT' && $type == 'ITU') {
if ($sat != 'All' && $sat != null) {
$this->db->where("COL_SAT_NAME", $sat);
}
if ($orbit != 'All' && $orbit != null) {
$this->db->where("satellite.orbit", $orbit);
}
} else {
$this->db->where("COL_PROP_MODE !=", "SAT");
}
break;
case 'WAS':
$this->db->where('COL_STATE', $searchphrase);

View File

@@ -11,6 +11,17 @@
height: calc(100vh - 480px) !important;
max-height: 900px !important;
}
.dropdown-filters-responsive {
width: 800px;
}
@media (max-width: 900px) {
.dropdown-filters-responsive {
width: 90vw;
max-width: none;
}
}
</style>
<div class="container">
@@ -123,7 +134,7 @@
<label class="col-md-2 control-label" for="band2"><?= __("Band"); ?></label>
<div class="col-md-3">
<select id="band2" name="band" class="form-select form-select-sm">
<option value="All" <?php if ($this->input->post('band', TRUE) == "All" || $this->input->method() !== 'post') echo ' selected'; ?> ><?= __("All"); ?></option>
<option value="All" <?php if ($this->input->post('band', TRUE) == "All" || $this->input->method() !== 'post') echo ' selected'; ?> ><?= __("Every band (w/o SAT)"); ?></option>
<?php foreach($worked_bands as $band) {
echo '<option value="' . $band . '"';
if ($this->input->post('band', TRUE) == $band) echo ' selected';
@@ -194,6 +205,9 @@
<td>#</td>
<td>" . __("ITU Zone") . "</td>";
foreach($bands as $band) {
if (($posted_band != 'SAT') && ($band == 'SAT')) {
continue;
}
echo '<td>' . $band . '</td>';
}
echo '</tr>
@@ -215,59 +229,42 @@
<thead>
<tr><td></td>";
$addsat='';
foreach($bands as $band) {
if ($band != 'SAT') {
echo '<td>' . $band . '</td>';
} else {
$addsat='<td>' . $band . '</td>';
if (($posted_band != 'SAT') && ($band == 'SAT')) {
continue;
}
echo '<td>' . $band . '</td>';
}
if ($posted_band != 'SAT') {
echo '<td><b>' . __("Total (ex SAT)") . '</b></td>';
}
if (count($bands) > 1) {
echo '<td class="spacingcell"></td>';
}
echo $addsat;
echo "</thead>
<tbody>
<tr><td>" . __("Total worked") . "</td>";
$sat_value = '';
foreach ($itu_summary['worked'] as $ituz => $value) {
if ($posted_band == 'SAT' && $ituz == 'Total') {
continue;
}
if ($ituz == 'SAT') {
$sat_value = '<td style="text-align: center"' . ($ituz === 'Total' ? " class='fw-bold'" : '') . '>' . $value . '</td>';
echo '<td style="text-align: center"' . ($ituz === 'Total' ? " class='fw-bold'" : '') . '>' . $value . '</td>';
} else {
echo '<td style="text-align: center"' . ($ituz === 'Total' ? " class='fw-bold'" : '') . '>' . $value . '</td>';
}
}
if (count($bands) > 1) {
echo '<td class="spacingcell"></td>';
}
echo $sat_value;
echo "</tr><tr>
<td>" . __("Total confirmed") . "</td>";
$sat_value = '';
foreach ($itu_summary['confirmed'] as $ituz => $value) {
if ($posted_band == 'SAT' && $ituz == 'Total') {
continue;
}
if ($ituz == 'SAT') {
$sat_value = '<td style="text-align: center"' . ($ituz === 'Total' ? " class='fw-bold'" : '') . '>' . $value . '</td>';
echo '<td style="text-align: center"' . ($ituz === 'Total' ? " class='fw-bold'" : '') . '>' . $value . '</td>';
} else {
echo '<td style="text-align: center"' . ($ituz === 'Total' ? " class='fw-bold'" : '') . '>' . $value . '</td>';
}
}
if (count($bands) > 1) {
echo '<td class="spacingcell"></td>';
}
echo $sat_value;
echo '</tr>
</table>
</div>';