Add first and last date in callstats

This commit is contained in:
Andreas Kristiansen
2025-08-24 17:28:29 +02:00
parent 1155722452
commit c4faf31bab
2 changed files with 15 additions and 5 deletions

View File

@@ -25,7 +25,9 @@ class Callstats_model extends CI_Model {
$sql = "select
`col_call` as `call`,
COUNT(*) as `count`
COUNT(*) as `count`,
min(col_time_on) as first_qso,
max(col_time_on) as last_qso
from " . $this->config->item('table_name') . "
left join satellite on ".$this->config->item('table_name').".COL_SAT_NAME = satellite.name
where station_id in (" . $location_list . ")";

View File

@@ -120,11 +120,10 @@
}
?>
<?php
$vucc_grids = array();
if ($activators_array) {
$result = write_activators($activators_array, $bandselect, $modeselect, $satselect, $orbit, $propagationselect);
$result = write_activators($activators_array, $bandselect, $modeselect, $satselect, $orbit, $propagationselect, $custom_date_format);
} else {
echo '<div class="alert alert-danger" role="alert">' . __("Nothing found!") . '</div>';
}
@@ -135,7 +134,7 @@
<?php
function write_activators($activators_array, $band, $mode, $sat, $orbit, $propagation)
function write_activators($activators_array, $band, $mode, $sat, $orbit, $propagation, $custom_date_format)
{
if ($band == '') {
$band = 'All';
@@ -147,16 +146,23 @@ function write_activators($activators_array, $band, $mode, $sat, $orbit, $propag
<td>#</td>
<td>' . __("Callsign") . '</td>
<td>' . __("#QSOs") . '</td>
<td>' . __("First QSO") . '</td>
<td>' . __("Last QSO") . '</td>
<td>' . __("Show QSOs") . '</td>
</tr>
</thead>
<tbody>';
$activators = array();
foreach ($activators_array as $line) {
$call = $line->call;
$count = $line->count;
array_push($activators, array($count, $call));
$timestamp = strtotime($line->first_qso);
$first_qso = date($custom_date_format, $timestamp);
$timestamp = strtotime($line->last_qso);
$last_qso = date($custom_date_format, $timestamp);
array_push($activators, array($count, $call, $first_qso, $last_qso));
}
arsort($activators);
foreach ($activators as $line) {
@@ -164,6 +170,8 @@ function write_activators($activators_array, $band, $mode, $sat, $orbit, $propag
<td>' . $i++ . '</td>
<td>' . $line[1] . '</td>
<td>' . $line[0] . '</td>
<td>' . $line[2] . '</td>
<td>' . $line[3] . '</td>
<td><a href=javascript:displayCallstatsContacts("' . $line[1] . '","' . $band . '","' . $mode . '","' . $sat . '","' . $orbit . '","' . $propagation . '")><i class="fas fa-list"></i></a></td>
</tr>';
}