[CQ Award] Adjusted so that SAT does not show when every band is chosen

This commit is contained in:
Andreas Kristiansen
2026-03-04 08:05:36 +01:00
parent f7ff6d218c
commit c60db090bd
2 changed files with 66 additions and 55 deletions

View File

@@ -17,6 +17,9 @@ class CQ extends CI_Model{
// Initialize all bands to dash // Initialize all bands to dash
foreach ($bands as $band) { foreach ($bands as $band) {
if (($postdata['band'] != 'SAT') && ($band == 'SAT')) {
continue;
}
for ($i = 1; $i <= 40; $i++) { for ($i = 1; $i <= 40; $i++) {
$bandCq[$i][$band] = '-'; // Sets all to dash to indicate no result $bandCq[$i][$band] = '-'; // Sets all to dash to indicate no result
} }
@@ -24,6 +27,9 @@ class CQ extends CI_Model{
// Initialize summary counters only for the bands passed in // Initialize summary counters only for the bands passed in
foreach ($bands as $band) { foreach ($bands as $band) {
if (($postdata['band'] != 'SAT') && ($band == 'SAT')) {
continue;
}
$summary['worked'][$band] = 0; $summary['worked'][$band] = 0;
$summary['confirmed'][$band] = 0; $summary['confirmed'][$band] = 0;
} }
@@ -92,55 +98,60 @@ class CQ extends CI_Model{
} }
} }
foreach ($cqdata_sat as $cq) { if ($postdata['band'] == 'SAT') {
// Skip if this band is not in our requested bands list foreach ($cqdata_sat as $cq) {
if (!isset($validBands[$cq->col_band])) { if (($postdata['band'] != 'SAT') && ($band == 'SAT')) {
continue; continue;
}
$cqZ[$cq->col_cqz]['count']++; // Count each cq zone
// Check if confirmed based on the confirmation types selected in postdata
$isConfirmed = false;
$confirmationLetters = '';
if (isset($postdata['qsl']) && $postdata['qsl'] == 1 && $cq->qsl == 1) {
$isConfirmed = true;
$confirmationLetters .= 'Q';
}
if (isset($postdata['lotw']) && $postdata['lotw'] == 1 && $cq->lotw == 1) {
$isConfirmed = true;
$confirmationLetters .= 'L';
}
if (isset($postdata['eqsl']) && $postdata['eqsl'] == 1 && $cq->eqsl == 1) {
$isConfirmed = true;
$confirmationLetters .= 'E';
}
if (isset($postdata['qrz']) && $postdata['qrz'] == 1 && $cq->qrz == 1) {
$isConfirmed = true;
$confirmationLetters .= 'Z';
}
if (isset($postdata['clublog']) && $postdata['clublog'] == 1 && $cq->clublog == 1) {
$isConfirmed = true;
$confirmationLetters .= 'C';
}
if ($isConfirmed) {
$bandCq[$cq->col_cqz][$cq->col_band] = '<div class="bg-success awardsBgSuccess"><a href=\'javascript:displayContacts("' . str_replace("&", "%26", $cq->col_cqz) . '","' . $cq->col_band . '","All", "All","'. $postdata['mode'] . '","CQZone","'.$qsl.'")\'>' . $confirmationLetters . '</a></div>';
// Track confirmed zones for summary
if (!isset($confirmedZones[$cq->col_band][$cq->col_cqz])) {
$confirmedZones[$cq->col_band][$cq->col_cqz] = true;
$summary['confirmed'][$cq->col_band]++;
} }
} else { // Skip if this band is not in our requested bands list
if ($postdata['worked'] != NULL) { if (!isset($validBands[$cq->col_band])) {
$bandCq[$cq->col_cqz][$cq->col_band] = '<div class="bg-danger awardsBgWarning"><a href=\'javascript:displayContacts("' . str_replace("&", "%26", $cq->col_cqz) . '","' . $cq->col_band . '","All", "All","'. $postdata['mode'] . '","CQZone","")\'>W</a></div>'; continue;
} }
}
// Track worked zones for summary $cqZ[$cq->col_cqz]['count']++; // Count each cq zone
if (!isset($workedZones[$cq->col_band][$cq->col_cqz])) {
$workedZones[$cq->col_band][$cq->col_cqz] = true; // Check if confirmed based on the confirmation types selected in postdata
$summary['worked'][$cq->col_band]++; $isConfirmed = false;
$confirmationLetters = '';
if (isset($postdata['qsl']) && $postdata['qsl'] == 1 && $cq->qsl == 1) {
$isConfirmed = true;
$confirmationLetters .= 'Q';
}
if (isset($postdata['lotw']) && $postdata['lotw'] == 1 && $cq->lotw == 1) {
$isConfirmed = true;
$confirmationLetters .= 'L';
}
if (isset($postdata['eqsl']) && $postdata['eqsl'] == 1 && $cq->eqsl == 1) {
$isConfirmed = true;
$confirmationLetters .= 'E';
}
if (isset($postdata['qrz']) && $postdata['qrz'] == 1 && $cq->qrz == 1) {
$isConfirmed = true;
$confirmationLetters .= 'Z';
}
if (isset($postdata['clublog']) && $postdata['clublog'] == 1 && $cq->clublog == 1) {
$isConfirmed = true;
$confirmationLetters .= 'C';
}
if ($isConfirmed) {
$bandCq[$cq->col_cqz][$cq->col_band] = '<div class="bg-success awardsBgSuccess"><a href=\'javascript:displayContacts("' . str_replace("&", "%26", $cq->col_cqz) . '","' . $cq->col_band . '","All", "All","'. $postdata['mode'] . '","CQZone","'.$qsl.'")\'>' . $confirmationLetters . '</a></div>';
// Track confirmed zones for summary
if (!isset($confirmedZones[$cq->col_band][$cq->col_cqz])) {
$confirmedZones[$cq->col_band][$cq->col_cqz] = true;
$summary['confirmed'][$cq->col_band]++;
}
} else {
if ($postdata['worked'] != NULL) {
$bandCq[$cq->col_cqz][$cq->col_band] = '<div class="bg-danger awardsBgWarning"><a href=\'javascript:displayContacts("' . str_replace("&", "%26", $cq->col_cqz) . '","' . $cq->col_band . '","All", "All","'. $postdata['mode'] . '","CQZone","")\'>W</a></div>';
}
}
// Track worked zones for summary
if (!isset($workedZones[$cq->col_band][$cq->col_cqz])) {
$workedZones[$cq->col_band][$cq->col_cqz] = true;
$summary['worked'][$cq->col_band]++;
}
} }
} }

View File

@@ -132,7 +132,7 @@
<label class="col-md-2 control-label" for="band2"><?= __("Band"); ?></label> <label class="col-md-2 control-label" for="band2"><?= __("Band"); ?></label>
<div class="col-md-3"> <div class="col-md-3">
<select id="band2" name="band" class="form-select form-select-sm"> <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) { <?php foreach($worked_bands as $band) {
echo '<option value="' . $band . '"'; echo '<option value="' . $band . '"';
if ($this->input->post('band', TRUE) == $band) echo ' selected'; if ($this->input->post('band', TRUE) == $band) echo ' selected';
@@ -203,8 +203,11 @@
<td>#</td> <td>#</td>
<td>" . __("CQ Zone") . "</td>"; <td>" . __("CQ Zone") . "</td>";
foreach($bands as $band) { foreach($bands as $band) {
echo '<td>' . $band . '</td>'; if (($posted_band != 'SAT') && ($band == 'SAT')) {
} continue;
}
echo '<td>' . $band . '</td>';
}
echo '</tr> echo '</tr>
</thead> </thead>
<tbody>'; <tbody>';
@@ -224,13 +227,11 @@
<thead> <thead>
<tr><td></td>"; <tr><td></td>";
$addsat='';
foreach($bands as $band) { foreach($bands as $band) {
if ($band != 'SAT') { if (($posted_band != 'SAT') && ($band == 'SAT')) {
echo '<td>' . $band . '</td>'; continue;
} else {
$addsat='<td>' . $band . '</td>';
} }
echo '<td>' . $band . '</td>';
} }
if ($posted_band != 'SAT') { if ($posted_band != 'SAT') {
echo '<td><b>' . __("Total (ex SAT)") . '</b></td>'; echo '<td><b>' . __("Total (ex SAT)") . '</b></td>';
@@ -238,7 +239,6 @@
if (count($bands) > 1) { if (count($bands) > 1) {
echo '<td class="spacingcell"></td>'; echo '<td class="spacingcell"></td>';
} }
echo $addsat;
echo "</thead> echo "</thead>
<tbody> <tbody>