1
0
Fork 0

Return always array in prediction_windows function

merge-requests/493/head
Alfredos-Panagiotis Damkalis 2018-06-16 23:45:22 +03:00
parent bf6a8af5e9
commit 90eef7a00f
2 changed files with 6 additions and 6 deletions

View File

@ -390,11 +390,11 @@ def prediction_windows(request, sat_id, transmitter, start_date, end_date,
try:
tr, azr, tt, altt, ts, azs = observer.next_pass(satellite)
except ValueError:
data = {
'error': 'That satellite seems to stay always below your horizon.'
}
if len(stations) == 1:
data = [{
'error': 'That satellite seems to stay always below your horizon.'
}]
break
# no match if the sat will not rise above the configured min horizon
elevation = format(math.degrees(altt), '.0f')
if ephem.Date(tr).datetime() < end_date:

View File

@ -64,8 +64,8 @@ $(document).ready( function(){
beforeSend: function() { $('#loading').show(); }
}).done(function(data) {
$('#loading').hide();
if (data.error) {
var error_msg = data.error;
if (data.length == 1 && data[0].error) {
var error_msg = data[0].error;
$('#windows-data').html('<span class="text-danger">' + error_msg + '</span>');
} else {
var dc = 0; // Data counter