Skip to content

Commit 4e65709

Browse files
committed
Separate SAT/EME DXCC reporting from band-based stats
Updated Monthlyreport_model to distinguish Satellite and EME DXCC entities from terrestrial bands, grouping them separately and including callsign/mode details. Modified report view to filter and display terrestrial, satellite, and EME DXCCs in distinct sections with improved formatting and additional QSO info.
1 parent 1ee55d3 commit 4e65709

2 files changed

Lines changed: 114 additions & 27 deletions

File tree

application/models/Monthlyreport_model.php

Lines changed: 78 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -245,9 +245,9 @@ private function get_new_dxcc($locations, $start_date, $end_date, $prev_month_en
245245
private function get_new_dxcc_by_band($locations, $start_date, $end_date, $prev_month_end) {
246246
$new_dxcc_by_band = array();
247247

248-
// Get all bands worked this month
248+
// Get all bands worked this month, plus propagation mode to separate SAT/EME
249249
$this->db->distinct();
250-
$this->db->select('COL_BAND');
250+
$this->db->select('COL_BAND, COL_PROP_MODE');
251251
$this->db->from($this->config->item('table_name'));
252252
$this->db->where_in('station_id', $locations);
253253
$this->db->where('COL_TIME_ON >=', $start_date);
@@ -260,9 +260,22 @@ private function get_new_dxcc_by_band($locations, $start_date, $end_date, $prev_
260260

261261
foreach ($bands_query->result() as $band_row) {
262262
$band = $band_row->COL_BAND;
263-
$new_dxcc_by_band[$band] = array();
263+
$prop_mode = $band_row->COL_PROP_MODE;
264264

265-
// Get all unique DXCC entities worked on this band this month (group by DXCC, get earliest callsign)
265+
// Group SAT and EME separately, not by frequency band
266+
if ($prop_mode == 'SAT') {
267+
$band_key = 'Satellite';
268+
} elseif ($prop_mode == 'EME') {
269+
$band_key = 'EME';
270+
} else {
271+
$band_key = $band;
272+
}
273+
274+
if (!isset($new_dxcc_by_band[$band_key])) {
275+
$new_dxcc_by_band[$band_key] = array();
276+
}
277+
278+
// Get all unique DXCC entities worked on this band/prop this month (group by DXCC, get earliest callsign)
266279
$this->db->select('COL_DXCC, MAX(COL_COUNTRY) as COL_COUNTRY, MIN(COL_TIME_ON) as FIRST_QSO', FALSE);
267280
$this->db->from($this->config->item('table_name'));
268281
$this->db->where_in('station_id', $locations);
@@ -271,30 +284,49 @@ private function get_new_dxcc_by_band($locations, $start_date, $end_date, $prev_
271284
$this->db->where('COL_BAND', $band);
272285
$this->db->where('COL_DXCC IS NOT NULL');
273286
$this->db->where('COL_DXCC !=', '');
287+
288+
// Filter by propagation mode
289+
if ($prop_mode) {
290+
$this->db->where('COL_PROP_MODE', $prop_mode);
291+
} else {
292+
// For terrestrial, exclude SAT and EME
293+
$this->db->where('(COL_PROP_MODE IS NULL OR (COL_PROP_MODE != "SAT" AND COL_PROP_MODE != "EME"))', NULL, FALSE);
294+
}
295+
274296
$this->db->group_by('COL_DXCC');
275297

276298
$query = $this->db->get();
277299

278300
foreach ($query->result() as $row) {
279-
// Check if this DXCC was worked before this month on this band
301+
// Check if this DXCC was worked before this month on this band/prop
280302
$this->db->select('COUNT(*) as count');
281303
$this->db->from($this->config->item('table_name'));
282304
$this->db->where_in('station_id', $locations);
283305
$this->db->where('COL_DXCC', $row->COL_DXCC);
284306
$this->db->where('COL_BAND', $band);
307+
if ($prop_mode) {
308+
$this->db->where('COL_PROP_MODE', $prop_mode);
309+
} else {
310+
$this->db->where('(COL_PROP_MODE IS NULL OR (COL_PROP_MODE != "SAT" AND COL_PROP_MODE != "EME"))', NULL, FALSE);
311+
}
285312
$this->db->where('COL_TIME_ON <', $start_date);
286313

287314
$prev_query = $this->db->get();
288315
$prev_row = $prev_query->row();
289316

290-
// If not worked before on this band, it's new
317+
// If not worked before on this band/prop, it's new
291318
if ($prev_row->count == 0) {
292-
// Get the callsign and mode from the first QSO with this DXCC on this band
319+
// Get the callsign and mode from the first QSO with this DXCC on this band/prop
293320
$this->db->select('COL_CALL, COL_MODE, COL_SUBMODE');
294321
$this->db->from($this->config->item('table_name'));
295322
$this->db->where_in('station_id', $locations);
296323
$this->db->where('COL_DXCC', $row->COL_DXCC);
297324
$this->db->where('COL_BAND', $band);
325+
if ($prop_mode) {
326+
$this->db->where('COL_PROP_MODE', $prop_mode);
327+
} else {
328+
$this->db->where('(COL_PROP_MODE IS NULL OR (COL_PROP_MODE != "SAT" AND COL_PROP_MODE != "EME"))', NULL, FALSE);
329+
}
298330
$this->db->where('COL_TIME_ON', $row->FIRST_QSO);
299331
$this->db->limit(1);
300332

@@ -306,12 +338,23 @@ private function get_new_dxcc_by_band($locations, $start_date, $end_date, $prev_
306338
$mode = !empty($call_row->COL_SUBMODE) ? $call_row->COL_SUBMODE : $call_row->COL_MODE;
307339
}
308340

309-
$new_dxcc_by_band[$band][] = array(
310-
'dxcc_id' => $row->COL_DXCC,
311-
'name' => $row->COL_COUNTRY,
312-
'callsign' => $call_row ? $call_row->COL_CALL : '',
313-
'mode' => $mode
314-
);
341+
// Avoid duplicates in the same band_key
342+
$already_added = false;
343+
foreach ($new_dxcc_by_band[$band_key] as $existing) {
344+
if ($existing['dxcc_id'] == $row->COL_DXCC) {
345+
$already_added = true;
346+
break;
347+
}
348+
}
349+
350+
if (!$already_added) {
351+
$new_dxcc_by_band[$band_key][] = array(
352+
'dxcc_id' => $row->COL_DXCC,
353+
'name' => $row->COL_COUNTRY,
354+
'callsign' => $call_row ? $call_row->COL_CALL : '',
355+
'mode' => $mode
356+
);
357+
}
315358
}
316359
}
317360
}
@@ -333,8 +376,8 @@ private function get_new_dxcc_by_band($locations, $start_date, $end_date, $prev_
333376
private function get_new_dxcc_by_prop($locations, $start_date, $end_date, $prev_month_end, $prop_mode) {
334377
$new_dxcc = array();
335378

336-
// Get all unique DXCC entities worked this month via this prop mode (group by DXCC)
337-
$this->db->select('COL_DXCC, MAX(COL_COUNTRY) as COL_COUNTRY', FALSE);
379+
// Get all unique DXCC entities worked this month via this prop mode (group by DXCC, get earliest time)
380+
$this->db->select('COL_DXCC, MAX(COL_COUNTRY) as COL_COUNTRY, MIN(COL_TIME_ON) as FIRST_QSO', FALSE);
338381
$this->db->from($this->config->item('table_name'));
339382
$this->db->where_in('station_id', $locations);
340383
$this->db->where('COL_TIME_ON >=', $start_date);
@@ -360,9 +403,28 @@ private function get_new_dxcc_by_prop($locations, $start_date, $end_date, $prev_
360403

361404
// If not worked before via this prop mode, it's new
362405
if ($prev_row->count == 0) {
406+
// Get the callsign and mode from the first QSO
407+
$this->db->select('COL_CALL, COL_MODE, COL_SUBMODE');
408+
$this->db->from($this->config->item('table_name'));
409+
$this->db->where_in('station_id', $locations);
410+
$this->db->where('COL_DXCC', $row->COL_DXCC);
411+
$this->db->where('COL_PROP_MODE', $prop_mode);
412+
$this->db->where('COL_TIME_ON', $row->FIRST_QSO);
413+
$this->db->limit(1);
414+
415+
$call_query = $this->db->get();
416+
$call_row = $call_query->row();
417+
418+
$mode = '';
419+
if ($call_row) {
420+
$mode = !empty($call_row->COL_SUBMODE) ? $call_row->COL_SUBMODE : $call_row->COL_MODE;
421+
}
422+
363423
$new_dxcc[] = array(
364424
'dxcc_id' => $row->COL_DXCC,
365-
'name' => $row->COL_COUNTRY
425+
'name' => $row->COL_COUNTRY,
426+
'callsign' => $call_row ? $call_row->COL_CALL : '',
427+
'mode' => $mode
366428
);
367429
}
368430
}

application/views/monthlyreport/report.php

Lines changed: 36 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -113,18 +113,31 @@
113113
<?php } ?>
114114

115115
<!-- New Countries by Band -->
116-
<?php if (!empty($report['new_dxcc_by_band'])) { ?>
116+
<?php
117+
// Filter out Satellite and EME from band list to see if there's anything to display
118+
$terrestrial_bands = array();
119+
if (!empty($report['new_dxcc_by_band'])) {
120+
foreach ($report['new_dxcc_by_band'] as $band => $dxcc_list) {
121+
if ($band != 'Satellite' && $band != 'EME') {
122+
$terrestrial_bands[$band] = $dxcc_list;
123+
}
124+
}
125+
}
126+
127+
if (!empty($terrestrial_bands)) {
128+
?>
117129
<div class="card mb-4 border-success">
118130
<div class="card-header bg-success bg-opacity-10 border-success">
119131
<h5 class="mb-0"><i class="fas fa-broadcast-tower text-success"></i> New Countries by Band</h5>
120132
</div>
121133
<div class="card-body">
122134
<?php
123135
// Bands already sorted in model
124-
foreach ($report['new_dxcc_by_band'] as $band => $dxcc_list) {
136+
foreach ($terrestrial_bands as $band => $dxcc_list) {
137+
$icon = '<i class="fas fa-signal"></i>';
125138
?>
126139
<div class="mb-3">
127-
<h6 class="text-muted"><i class="fas fa-signal"></i> <?php echo $band; ?> (<?php echo count($dxcc_list); ?> new)</h6>
140+
<h6 class="text-muted"><?php echo $icon; ?> <?php echo $band; ?> (<?php echo count($dxcc_list); ?> new)</h6>
128141
<div class="row">
129142
<?php foreach ($dxcc_list as $dxcc) { ?>
130143
<div class="col-md-6 col-lg-4 mb-2">
@@ -155,10 +168,16 @@
155168
<div class="card-body">
156169
<div class="row">
157170
<?php foreach ($report['new_dxcc_satellite'] as $dxcc) { ?>
158-
<div class="col-md-4 mb-2">
159-
<span class="badge bg-success fs-6">
160-
<i class="fas fa-satellite-dish"></i> <?php echo $dxcc['name']; ?>
161-
</span>
171+
<div class="col-md-6 col-lg-4 mb-2">
172+
<div class="d-flex align-items-center">
173+
<span class="badge bg-success me-2">
174+
<i class="fas fa-star"></i> <?php echo $dxcc['name']; ?>
175+
</span>
176+
<small class="text-muted">
177+
<?php echo $dxcc['callsign']; ?>
178+
<?php if (!empty($dxcc['mode'])) echo '' . $dxcc['mode']; ?>
179+
</small>
180+
</div>
162181
</div>
163182
<?php } ?>
164183
</div>
@@ -175,10 +194,16 @@
175194
<div class="card-body">
176195
<div class="row">
177196
<?php foreach ($report['new_dxcc_eme'] as $dxcc) { ?>
178-
<div class="col-md-4 mb-2">
179-
<span class="badge bg-success fs-6">
180-
<i class="fas fa-moon"></i> <?php echo $dxcc['name']; ?>
181-
</span>
197+
<div class="col-md-6 col-lg-4 mb-2">
198+
<div class="d-flex align-items-center">
199+
<span class="badge bg-success me-2">
200+
<i class="fas fa-star"></i> <?php echo $dxcc['name']; ?>
201+
</span>
202+
<small class="text-muted">
203+
<?php echo $dxcc['callsign']; ?>
204+
<?php if (!empty($dxcc['mode'])) echo '' . $dxcc['mode']; ?>
205+
</small>
206+
</div>
182207
</div>
183208
<?php } ?>
184209
</div>

0 commit comments

Comments
 (0)