for historic data: prepare to remove lat lon from route api requests

this needs some API changes before it can work without failing
This commit is contained in:
Matthias Wirth
2025-10-22 16:01:50 +00:00
parent ae70294e26
commit db2f2543ca

View File

@@ -2911,7 +2911,7 @@ PlaneObject.prototype.routeCheck = function() {
return;
}
if (!this.position ) {
if (!this.position) {
// don't update if no position
return;
}
@@ -2927,6 +2927,12 @@ PlaneObject.prototype.routeCheck = function() {
if (!route || currentTime > route.tarNextUpdate) {
// we have all the pieces that allow us to lookup a route
let route_check = { 'callsign': currentName, 'lat': this.position[1], 'lng': this.position[0], icao: this.icao};
/*
if (showTrace || replay) {
delete route_check['lat'];
delete route_check['lng'];
}
*/
g.route_check_todo[currentName] = route_check;
return;
}
@@ -2999,12 +3005,27 @@ function routeDoLookup(currentTime) {
console.log(`${currentTime}: g.route_check_checking:`, g.route_check_checking);
}
const requestRoutes = [];
for (const entry of g.route_check_checking) {
requestRoutes.push({
callsign: entry['callsign'],
lat: entry['lat'],
lng: entry['lng'],
});
}
const requestBody = JSON.stringify({ 'planes': requestRoutes });
if (debugRoute) {
console.log(`${currentTime}: requesting routes:`, requestBody);
}
jQuery.ajax({
type: "POST",
url: routeApiUrl,
contentType: 'application/json; charset=utf-8',
dataType: 'json',
data: JSON.stringify({ 'planes': g.route_check_checking }),
data: requestBody,
})
.done((routes) => {
let currentTime = new Date().getTime()/1000;