Distances worked analytics: bugfix and average distance

This commit is contained in:
Danny 2024-06-16 19:40:24 +02:00
parent 54dea657ec
commit a685b233c6
18 changed files with 59 additions and 20 deletions

View File

@ -25,10 +25,12 @@ $lang['statistics_number_of_qso_worked'] = "# of QSO's worked";
*
*/
$lang['statistics_distances_bands_all'] = "All";
$lang['statistics_distances_worked'] = "Distances Worked";
$lang['statistics_distances_part1_contacts_were_plotted_furthest'] = "contacts were plotted.<br /> Your furthest contact was with";
$lang['statistics_distances_part2_contacts_were_plotted_furthest'] = "in gridsquare";
$lang['statistics_distances_part3_contacts_were_plotted_furthest'] = "the distance was";
$lang['statistics_distances_part3_contacts_were_plotted_furthest'] = "The distance was";
$lang['statistics_distances_part4_contacts_were_plotted_furthest'] = "The average distance is";
$lang['statistics_distances_number_of_qsos'] = "Number of QSOs";
$lang['statistics_distances_callsigns_worked'] = "Callsign(s) worked (max 5 shown)";
$lang['statistics_distances_qsos_with'] = "QSOs with";

View File

@ -25,10 +25,12 @@ $lang['statistics_number_of_qso_worked'] = "通联的 QSO 数量";
*
*/
$lang['statistics_distances_bands_all'] = "全部";
$lang['statistics_distances_worked'] = "通联距离";
$lang['statistics_distances_part1_contacts_were_plotted_furthest'] = "次通联<br /> 您最远的通联是与";
$lang['statistics_distances_part2_contacts_were_plotted_furthest'] = "在网格";
$lang['statistics_distances_part3_contacts_were_plotted_furthest'] = "距离是";
$lang['statistics_distances_part4_contacts_were_plotted_furthest'] = "平均距离是";
$lang['statistics_distances_number_of_qsos'] = "QSO 数量";
$lang['statistics_distances_callsigns_worked'] = "通联的呼号最多显示5个";
$lang['statistics_distances_qsos_with'] = "QSO 与";

View File

@ -25,10 +25,12 @@ $lang['statistics_number_of_qso_worked'] = "# of QSO's worked";
*
*/
$lang['statistics_distances_bands_all'] = "All";
$lang['statistics_distances_worked'] = "Distances Worked";
$lang['statistics_distances_part1_contacts_were_plotted_furthest'] = "contacts were plotted.<br /> Your furthest contact was with";
$lang['statistics_distances_part2_contacts_were_plotted_furthest'] = "in gridsquare";
$lang['statistics_distances_part3_contacts_were_plotted_furthest'] = "the distance was";
$lang['statistics_distances_part3_contacts_were_plotted_furthest'] = "The distance was";
$lang['statistics_distances_part4_contacts_were_plotted_furthest'] = "The average distance is";
$lang['statistics_distances_number_of_qsos'] = "Number of QSOs";
$lang['statistics_distances_callsigns_worked'] = "Callsign(s) worked (max 5 shown)";
$lang['statistics_distances_qsos_with'] = "QSOs with";

View File

@ -25,10 +25,12 @@ $lang['statistics_number_of_qso_worked'] = "# of QSO's worked";
*
*/
$lang['statistics_distances_bands_all'] = "All";
$lang['statistics_distances_worked'] = "Distances Worked";
$lang['statistics_distances_part1_contacts_were_plotted_furthest'] = "contacts were plotted.<br /> Your furthest contact was with";
$lang['statistics_distances_part2_contacts_were_plotted_furthest'] = "in gridsquare";
$lang['statistics_distances_part3_contacts_were_plotted_furthest'] = "the distance was";
$lang['statistics_distances_part3_contacts_were_plotted_furthest'] = "The distance was";
$lang['statistics_distances_part4_contacts_were_plotted_furthest'] = "The average distance is";
$lang['statistics_distances_number_of_qsos'] = "Number of QSOs";
$lang['statistics_distances_callsigns_worked'] = "Callsign(s) worked (max 5 shown)";
$lang['statistics_distances_qsos_with'] = "QSOs with";

View File

@ -25,10 +25,12 @@ $lang['statistics_number_of_qso_worked'] = "# of QSO's worked";
*
*/
$lang['statistics_distances_bands_all'] = "All";
$lang['statistics_distances_worked'] = "Distances Worked";
$lang['statistics_distances_part1_contacts_were_plotted_furthest'] = "contacts were plotted.<br /> Your furthest contact was with";
$lang['statistics_distances_part2_contacts_were_plotted_furthest'] = "in gridsquare";
$lang['statistics_distances_part3_contacts_were_plotted_furthest'] = "the distance was";
$lang['statistics_distances_part3_contacts_were_plotted_furthest'] = "The distance was";
$lang['statistics_distances_part4_contacts_were_plotted_furthest'] = "The average distance is";
$lang['statistics_distances_number_of_qsos'] = "Number of QSOs";
$lang['statistics_distances_callsigns_worked'] = "Callsign(s) worked (max 5 shown)";
$lang['statistics_distances_qsos_with'] = "QSOs with";

View File

@ -25,10 +25,12 @@ $lang['statistics_number_of_qso_worked'] = "# of QSO's worked";
*
*/
$lang['statistics_distances_bands_all'] = "All";
$lang['statistics_distances_worked'] = "Distances Worked";
$lang['statistics_distances_part1_contacts_were_plotted_furthest'] = "contacts were plotted.<br /> Your furthest contact was with";
$lang['statistics_distances_part2_contacts_were_plotted_furthest'] = "in gridsquare";
$lang['statistics_distances_part3_contacts_were_plotted_furthest'] = "the distance was";
$lang['statistics_distances_part3_contacts_were_plotted_furthest'] = "The distance was";
$lang['statistics_distances_part4_contacts_were_plotted_furthest'] = "The average distance is";
$lang['statistics_distances_number_of_qsos'] = "Number of QSOs";
$lang['statistics_distances_callsigns_worked'] = "Callsign(s) worked (max 5 shown)";
$lang['statistics_distances_qsos_with'] = "QSOs with";

View File

@ -25,10 +25,12 @@ $lang['statistics_number_of_qso_worked'] = "QSOs réalisés";
*
*/
$lang['statistics_distances_worked'] = "Nombre de QSOs par plage de distances réalisées";
$lang['statistics_distances_part1_contacts_were_plotted_furthest'] = "contacts utilisés pour le graphique.<br> Le dernier contact réalisé est : ";
$lang['statistics_distances_part2_contacts_were_plotted_furthest'] = ", avec le locator : ";
$lang['statistics_distances_part3_contacts_were_plotted_furthest'] = ", pour une distance de : ";
$lang['statistics_distances_bands_all'] = "Toutes";
$lang['statistics_distances_worked'] = "Nombre de QSOs réalisés par plage de distance";
$lang['statistics_distances_part1_contacts_were_plotted_furthest'] = "contacts utilisés pour le graphique.<br> Le contact le plus lointain réalisé est ";
$lang['statistics_distances_part2_contacts_were_plotted_furthest'] = "avec le locator";
$lang['statistics_distances_part3_contacts_were_plotted_furthest'] = "La distance maximale est de";
$lang['statistics_distances_part4_contacts_were_plotted_furthest'] = "La distance moyenne est de";
$lang['statistics_distances_number_of_qsos'] = "Nombre de QSOs";
$lang['statistics_distances_callsigns_worked'] = "Indicatif(s) contacté(s) (liste de 5 max)";
$lang['statistics_distances_qsos_with'] = "QSOs avec";

View File

@ -25,10 +25,12 @@ $lang['statistics_number_of_qso_worked'] = "# gearbeitete QSOs";
*
*/
$lang['statistics_distances_bands_all'] = "Alle";
$lang['statistics_distances_worked'] = "Gearbeitete Entfernungen";
$lang['statistics_distances_part1_contacts_were_plotted_furthest'] = "Kontakte wurden dargestellt.<br /> Der weiteste Kontakt war"; // make sure'<br />' stays there
$lang['statistics_distances_part2_contacts_were_plotted_furthest'] = "im Planquadrat";
$lang['statistics_distances_part3_contacts_were_plotted_furthest'] = "Die Distanz betrug";
$lang['statistics_distances_part4_contacts_were_plotted_furthest'] = "Die durchschnittliche Distanz ist";
$lang['statistics_distances_number_of_qsos'] = "Anzahl der QSOs";
$lang['statistics_distances_callsigns_worked'] = "Gearbeitete(s) Rufzeichen (max 5 werden gezeigt)";
$lang['statistics_distances_qsos_with'] = "QSOs mit";

View File

@ -25,10 +25,12 @@ $lang['statistics_number_of_qso_worked'] = "# of QSO's worked";
*
*/
$lang['statistics_distances_bands_all'] = "All";
$lang['statistics_distances_worked'] = "Distances Worked";
$lang['statistics_distances_part1_contacts_were_plotted_furthest'] = "contacts were plotted.<br /> Your furthest contact was with";
$lang['statistics_distances_part2_contacts_were_plotted_furthest'] = "in gridsquare";
$lang['statistics_distances_part3_contacts_were_plotted_furthest'] = "the distance was";
$lang['statistics_distances_part3_contacts_were_plotted_furthest'] = "The distance was";
$lang['statistics_distances_part4_contacts_were_plotted_furthest'] = "The average distance is";
$lang['statistics_distances_number_of_qsos'] = "Number of QSOs";
$lang['statistics_distances_callsigns_worked'] = "Callsign(s) worked (max 5 shown)";
$lang['statistics_distances_qsos_with'] = "QSOs with";

View File

@ -25,10 +25,12 @@ $lang['statistics_number_of_qso_worked'] = "# di QSO effettuati";
*
*/
$lang['statistics_distances_bands_all'] = "Tutte";
$lang['statistics_distances_worked'] = "Distanze percorse";
$lang['statistics_distances_part1_contacts_were_plotted_furthest'] = "i contatti sono stati tracciati.<br /> Il tuo contatto più lontano era con";
$lang['statistics_distances_part2_contacts_were_plotted_furthest'] = "nella griglia";
$lang['statistics_distances_part3_contacts_were_plotted_furthest'] = "la distanza era";
$lang['statistics_distances_part3_contacts_were_plotted_furthest'] = "La distanza era";
$lang['statistics_distances_part4_contacts_were_plotted_furthest'] = "La distanza media è";
$lang['statistics_distances_number_of_qsos'] = "Numero di QSO";
$lang['statistics_distances_callsigns_worked'] = "Nominativo(i) funzionante(i max 5 mostrati)";
$lang['statistics_distances_qsos_with'] = "QSO con";

View File

@ -25,10 +25,12 @@ $lang['statistics_number_of_qso_worked'] = "# of QSO's worked";
*
*/
$lang['statistics_distances_bands_all'] = "All";
$lang['statistics_distances_worked'] = "Distances Worked";
$lang['statistics_distances_part1_contacts_were_plotted_furthest'] = "contacts were plotted.<br /> Your furthest contact was with";
$lang['statistics_distances_part2_contacts_were_plotted_furthest'] = "in gridsquare";
$lang['statistics_distances_part3_contacts_were_plotted_furthest'] = "the distance was";
$lang['statistics_distances_part3_contacts_were_plotted_furthest'] = "The distance was";
$lang['statistics_distances_part4_contacts_were_plotted_furthest'] = "The average distance is";
$lang['statistics_distances_number_of_qsos'] = "Number of QSOs";
$lang['statistics_distances_callsigns_worked'] = "Callsign(s) worked (max 5 shown)";
$lang['statistics_distances_qsos_with'] = "QSOs with";

View File

@ -25,10 +25,12 @@ $lang['statistics_number_of_qso_worked'] = "# QSO проведено";
*
*/
$lang['statistics_distances_bands_all'] = "все";
$lang['statistics_distances_worked'] = "Сработанные дистанции";
$lang['statistics_distances_part1_contacts_were_plotted_furthest'] = "контакты отображены.<br /> Наиболее дальний контакт с";
$lang['statistics_distances_part2_contacts_were_plotted_furthest'] = "в квадрате";
$lang['statistics_distances_part3_contacts_were_plotted_furthest'] = "на дистанции";
$lang['statistics_distances_part4_contacts_were_plotted_furthest'] = "Среднее расстояние составляет";
$lang['statistics_distances_number_of_qsos'] = "Количество QSO";
$lang['statistics_distances_callsigns_worked'] = "Сработанные позывные(ной) (максимально 5 показано)";
$lang['statistics_distances_qsos_with'] = "QSOs с";

View File

@ -25,10 +25,12 @@ $lang['statistics_number_of_qso_worked'] = "# de QSOs logradas";
*
*/
$lang['statistics_distances_bands_all'] = "Todas";
$lang['statistics_distances_worked'] = "Distancias Logradas";
$lang['statistics_distances_part1_contacts_were_plotted_furthest'] = "contactos fueron dibujados.<br /> Su contacto más lejano fue con";
$lang['statistics_distances_part2_contacts_were_plotted_furthest'] = "en gridsquare";
$lang['statistics_distances_part3_contacts_were_plotted_furthest'] = "la distancia fue";
$lang['statistics_distances_part3_contacts_were_plotted_furthest'] = "La distancia fue";
$lang['statistics_distances_part4_contacts_were_plotted_furthest'] = "La distancia promedio es";
$lang['statistics_distances_number_of_qsos'] = "Número de QSOs";
$lang['statistics_distances_callsigns_worked'] = "Indicativo(s) trabajados (se muestran máximo 5)";
$lang['statistics_distances_qsos_with'] = "QSOs con";

View File

@ -25,10 +25,12 @@ $lang['statistics_number_of_qso_worked'] = "# of QSO's worked";
*
*/
$lang['statistics_distances_bands_all'] = "All";
$lang['statistics_distances_worked'] = "Distances Worked";
$lang['statistics_distances_part1_contacts_were_plotted_furthest'] = "contacts were plotted.<br /> Your furthest contact was with";
$lang['statistics_distances_part2_contacts_were_plotted_furthest'] = "in gridsquare";
$lang['statistics_distances_part3_contacts_were_plotted_furthest'] = "the distance was";
$lang['statistics_distances_part3_contacts_were_plotted_furthest'] = "The distance was";
$lang['statistics_distances_part4_contacts_were_plotted_furthest'] = "The average distance is";
$lang['statistics_distances_number_of_qsos'] = "Number of QSOs";
$lang['statistics_distances_callsigns_worked'] = "Callsign(s) worked (max 5 shown)";
$lang['statistics_distances_qsos_with'] = "QSOs with";

View File

@ -25,10 +25,12 @@ $lang['statistics_number_of_qso_worked'] = "Çalışan QSO sayısı";
*
*/
$lang['statistics_distances_bands_all'] = "Tüm";
$lang['statistics_distances_worked'] = "Çalışılan Mesafeler";
$lang['statistics_distances_part1_contacts_were_plotted_furthest'] = "kişiler planlandı.<br /> En uzak bağlantınız şununlaydı";
$lang['statistics_distances_part2_contacts_were_plotted_furthest'] = "gridsquare'de";
$lang['statistics_distances_part3_contacts_were_plotted_furthest'] = "mesafe şuydu";
$lang['statistics_distances_part3_contacts_were_plotted_furthest'] = "Mesafe şuydu";
$lang['statistics_distances_part4_contacts_were_plotted_furthest'] = "Ortalama mesafe";
$lang['statistics_distances_number_of_qsos'] = "QSO sayısı";
$lang['statistics_distances_callsigns_worked'] = "Çağrı işaretleri çalıştı (en fazla 5 tane gösterildi)";
$lang['statistics_distances_qsos_with'] = "QSO'lar ile";

View File

@ -33,7 +33,7 @@ class Distances_model extends CI_Model
$this->db->where('col_sat_name', $postdata['sat']);
}
}
else {
elseif ($postdata['band'] != 'all') {
$this->db->where('col_band', $postdata['band']);
}
@ -143,7 +143,7 @@ class Distances_model extends CI_Model
$dist = '20000';
}
if (!$this->valid_locator($stationgrid)) {
if (!$this->valid_locator(substr($stationgrid, 0, 6))) {
header('Content-Type: application/json');
echo json_encode(array('Error' => 'Error. There is a problem with the gridsquare set in your profile!'));
exit;
@ -163,12 +163,16 @@ class Distances_model extends CI_Model
'Grid' => '',
'Distance' => '',
'Qsos' => '',
'Grids' => ''
'Grids' => '',
'Avg_distance' => ''
);
$avg_distance = 0;
foreach ($qsoArray as $qso) {
$qrb['Qsos']++; // Counts up number of qsos
$bearingdistance = $this->qra->distance($stationgrid, $qso['grid'], $measurement_base);
$avg_distance += ($bearingdistance - $avg_distance) / $qrb['Qsos']; // Calculates running average of distance
if ($bearingdistance != $qso['COL_DISTANCE']) {
$data = array('COL_DISTANCE' => $bearingdistance);
$this->db->where('COL_PRIMARY_KEY', $qso['COL_PRIMARY_KEY']);
@ -190,6 +194,8 @@ class Distances_model extends CI_Model
}
}
$qrb['Avg_distance'] = round($avg_distance, 1);
$data['ok'] = 'OK';
$data['qrb'] = $qrb;
$data['qsodata'] = $dataarray;

View File

@ -9,6 +9,7 @@
var lang_statistics_distances_part1_contacts_were_plotted_furthest = '<?php echo lang('statistics_distances_part1_contacts_were_plotted_furthest'); ?>';
var lang_statistics_distances_part2_contacts_were_plotted_furthest = '<?php echo lang('statistics_distances_part2_contacts_were_plotted_furthest'); ?>';
var lang_statistics_distances_part3_contacts_were_plotted_furthest = '<?php echo lang('statistics_distances_part3_contacts_were_plotted_furthest'); ?>';
var lang_statistics_distances_part4_contacts_were_plotted_furthest = '<?php echo lang('statistics_distances_part4_contacts_were_plotted_furthest'); ?>';
var lang_statistics_distances_number_of_qsos = '<?php echo lang('statistics_distances_number_of_qsos'); ?>';
var lang_gen_hamradio_distance = '<?php echo lang('gen_hamradio_distance'); ?>';
var lang_statistics_distances_callsigns_worked = '<?php echo lang('statistics_distances_callsigns_worked'); ?>';
@ -18,6 +19,7 @@
<form class="d-flex align-items-center">
<label class="my-1 me-2" for="distplot_bands"><?php echo lang('gen_band_selection'); ?></label>
<select class="form-select my-1 me-sm-2 w-auto" id="distplot_bands">
<option value="all"><?php echo lang('statistics_distances_bands_all')?></option>
<?php if (count($sats_available) != 0) { ?>
<option value="sat">SAT</option>
<?php } ?>
@ -27,7 +29,7 @@
</select>
<?php if (count($sats_available) != 0) { ?>
<label class="my-1 me-2" for="distplot_sats"><?php echo lang('general_word_satellite')?></label>
<select class="form-select my-1 me-sm-2 w-auto" id="distplot_sats">
<select class="form-select my-1 me-sm-2 w-auto" disabled id="distplot_sats">
<option value="All"><?php echo lang('general_word_all')?></option>
<?php foreach($sats_available as $sat) {
echo '<option value="' . $sat . '"' . '>' . $sat . '</option>'."\n";

View File

@ -117,7 +117,8 @@ function distPlot(form) {
$('#information').html(tmp.qrb.Qsos + " " + lang_statistics_distances_part1_contacts_were_plotted_furthest + " " + tmp.qrb.Callsign
+ " " + lang_statistics_distances_part2_contacts_were_plotted_furthest + " " + tmp.qrb.Grid
+". " + lang_statistics_distances_part3_contacts_were_plotted_furthest + " "
+ tmp.qrb.Distance + tmp.unit + ".");
+ tmp.qrb.Distance + " " + tmp.unit + ". " + lang_statistics_distances_part4_contacts_were_plotted_furthest + " "
+ tmp.qrb.Avg_distance + " " + tmp.unit + ".");
var chart = new Highcharts.Chart(options);
}