Merge pull request #3034 from AndreasK79/cq_band_without_sat

[CQ Award] Adjusted so that SAT does not show when every band is chosen
This commit is contained in:
Andreas Kristiansen
2026-03-05 08:39:35 +01:00
committed by GitHub
3 changed files with 79 additions and 72 deletions

View File

@@ -17,6 +17,9 @@ class CQ extends CI_Model{
// Initialize all bands to dash
foreach ($bands as $band) {
if (($postdata['band'] != 'SAT') && ($band == 'SAT')) {
continue;
}
for ($i = 1; $i <= 40; $i++) {
$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
foreach ($bands as $band) {
if (($postdata['band'] != 'SAT') && ($band == 'SAT')) {
continue;
}
$summary['worked'][$band] = 0;
$summary['confirmed'][$band] = 0;
}
@@ -92,55 +98,60 @@ class CQ extends CI_Model{
}
}
foreach ($cqdata_sat as $cq) {
// Skip if this band is not in our requested bands list
if (!isset($validBands[$cq->col_band])) {
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]++;
if ($postdata['band'] == 'SAT') {
foreach ($cqdata_sat as $cq) {
if (($postdata['band'] != 'SAT') && ($band == 'SAT')) {
continue;
}
} 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>';
// Skip if this band is not in our requested bands list
if (!isset($validBands[$cq->col_band])) {
continue;
}
}
// 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]++;
$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 {
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

@@ -543,6 +543,16 @@ class Logbook_model extends CI_Model {
break;
case 'CQZone':
$this->db->where('COL_CQZ', $searchphrase);
if ($band == 'SAT' && $type == 'CQZone') {
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 'ITU':
$this->db->where('COL_ITUZ', $searchphrase);

View File

@@ -132,7 +132,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';
@@ -203,8 +203,11 @@
<td>#</td>
<td>" . __("CQ Zone") . "</td>";
foreach($bands as $band) {
echo '<td>' . $band . '</td>';
}
if (($posted_band != 'SAT') && ($band == 'SAT')) {
continue;
}
echo '<td>' . $band . '</td>';
}
echo '</tr>
</thead>
<tbody>';
@@ -224,59 +227,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 ($cq_summary['worked'] as $cqz => $value) {
if ($posted_band == 'SAT' && $cqz == 'Total') {
continue;
}
if ($cqz == 'SAT') {
$sat_value = '<td style="text-align: center"' . ($cqz === 'Total' ? " class='fw-bold'" : '') . '>' . $value . '</td>';
echo '<td style="text-align: center"' . ($cqz === 'Total' ? " class='fw-bold'" : '') . '>' . $value . '</td>';
} else {
echo '<td style="text-align: center"' . ($cqz === '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 ($cq_summary['confirmed'] as $cqz => $value) {
if ($posted_band == 'SAT' && $cqz == 'Total') {
continue;
}
if ($cqz == 'SAT') {
$sat_value = '<td style="text-align: center"' . ($cqz === 'Total' ? " class='fw-bold'" : '') . '>' . $value . '</td>';
echo '<td style="text-align: center"' . ($cqz === 'Total' ? " class='fw-bold'" : '') . '>' . $value . '</td>';
} else {
echo '<td style="text-align: center"' . ($cqz === 'Total' ? " class='fw-bold'" : '') . '>' . $value . '</td>';
}
}
if (count($bands) > 1) {
echo '<td class="spacingcell"></td>';
}
echo $sat_value;
echo '</tr>
</table>
</div>';