Skip to content

Commit 02f7205

Browse files
authored
Attempt 2 at fixing predictions
1 parent e1afec4 commit 02f7205

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

js/tracker.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,10 @@ function launchSitePredictions(times, station, properties, marker) {
720720
var lon = ((360 + (position[1] % 360)) % 360)
721721
//var url = "https://predict.cusf.co.uk/api/v1/?launch_latitude=" + position[0] + "&launch_longitude=" + lon + "&launch_datetime=" + dates[i] + "&ascent_rate=" + properties[0] + "&burst_altitude=" + properties[2] + "&descent_rate=" + properties[1];
722722
var url = "https://api.v2.sondehub.org/tawhiri?launch_latitude=" + position[0] + "&launch_longitude=" + lon + "&launch_datetime=" + dates[i] + "&ascent_rate=" + properties[0] + "&burst_altitude=" + properties[2] + "&descent_rate=" + properties[1];
723-
showPrediction(url).done(handleData).fail(handleError);
723+
var delayInMilliseconds = 50;
724+
setTimeout(function() {
725+
showPrediction(url).done(handleData).fail(handleError);
726+
}, delayInMilliseconds);
724727
}
725728
function handleData(data) {
726729
completed += 1;
@@ -814,14 +817,11 @@ function plotPrediction (data, dates, marker, properties) {
814817
}
815818

816819
function showPrediction(url) {
817-
var delayInMilliseconds = Math.random() * (50 - 20) + 20;
818-
setTimeout(function() {
819-
return $.ajax({
820-
type: "GET",
821-
url: url,
822-
dataType: "json",
823-
});
824-
}, delayInMilliseconds);
820+
return $.ajax({
821+
type: "GET",
822+
url: url,
823+
dataType: "json",
824+
});
825825
}
826826

827827
function deletePredictions(marker) {

0 commit comments

Comments
 (0)