Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Distances Worked analytics: bugfix, All bands options and Average distance #3143

Merged
merged 1 commit into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion application/language/bulgarian/statistics_lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@
*
*/

$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";
Expand Down
2 changes: 2 additions & 0 deletions application/language/chinese_simplified/statistics_lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@
*
*/

$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 与";
Expand Down
4 changes: 3 additions & 1 deletion application/language/czech/statistics_lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@
*
*/

$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";
Expand Down
4 changes: 3 additions & 1 deletion application/language/dutch/statistics_lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@
*
*/

$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";
Expand Down
4 changes: 3 additions & 1 deletion application/language/english/statistics_lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@
*
*/

$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";
Expand Down
4 changes: 3 additions & 1 deletion application/language/finnish/statistics_lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@
*
*/

$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";
Expand Down
10 changes: 6 additions & 4 deletions application/language/french/statistics_lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@
*
*/

$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";
Expand Down
2 changes: 2 additions & 0 deletions application/language/german/statistics_lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@
*
*/

$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";
Expand Down
4 changes: 3 additions & 1 deletion application/language/greek/statistics_lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@
*
*/

$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";
Expand Down
4 changes: 3 additions & 1 deletion application/language/italian/statistics_lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@
*
*/

$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";
Expand Down
4 changes: 3 additions & 1 deletion application/language/polish/statistics_lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@
*
*/

$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";
Expand Down
2 changes: 2 additions & 0 deletions application/language/russian/statistics_lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@
*
*/

$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 с";
Expand Down
4 changes: 3 additions & 1 deletion application/language/spanish/statistics_lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@
*
*/

$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";
Expand Down
4 changes: 3 additions & 1 deletion application/language/swedish/statistics_lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@
*
*/

$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";
Expand Down
4 changes: 3 additions & 1 deletion application/language/turkish/statistics_lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@
*
*/

$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";
Expand Down
12 changes: 9 additions & 3 deletions application/models/Distances_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function get_distances($postdata, $measurement_base) {
$this->db->where('col_sat_name', $postdata['sat']);
}
}
else {
elseif ($postdata['band'] != 'all') {
$this->db->where('col_band', $postdata['band']);
}

Expand Down Expand Up @@ -143,7 +143,7 @@ function plot($qsoArray, $gridsquare, $measurement_base) {
$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;
Expand All @@ -163,12 +163,16 @@ function plot($qsoArray, $gridsquare, $measurement_base) {
'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']);
Expand All @@ -190,6 +194,8 @@ function plot($qsoArray, $gridsquare, $measurement_base) {
}
}

$qrb['Avg_distance'] = round($avg_distance, 1);

$data['ok'] = 'OK';
$data['qrb'] = $qrb;
$data['qsodata'] = $dataarray;
Expand Down
4 changes: 3 additions & 1 deletion application/views/distances/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'); ?>';
Expand All @@ -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 } ?>
Expand All @@ -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";
Expand Down
3 changes: 2 additions & 1 deletion assets/js/sections/distances.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Loading