Departed Today cleanup
This commit is contained in:
@@ -1575,9 +1575,8 @@
|
|||||||
document.getElementById('departed-no-data').style.display = 'none';
|
document.getElementById('departed-no-data').style.display = 'none';
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const [pprResponse, localResponse, depResponse] = await Promise.all([
|
const [pprResponse, depResponse] = await Promise.all([
|
||||||
authenticatedFetch('/api/v1/pprs/?limit=1000'),
|
authenticatedFetch('/api/v1/pprs/?limit=1000'),
|
||||||
authenticatedFetch('/api/v1/local-flights/?status=DEPARTED&limit=1000'),
|
|
||||||
authenticatedFetch('/api/v1/departures/?status=DEPARTED&limit=1000')
|
authenticatedFetch('/api/v1/departures/?status=DEPARTED&limit=1000')
|
||||||
]);
|
]);
|
||||||
|
|
||||||
@@ -1588,7 +1587,7 @@
|
|||||||
const allPPRs = await pprResponse.json();
|
const allPPRs = await pprResponse.json();
|
||||||
const today = new Date().toISOString().split('T')[0];
|
const today = new Date().toISOString().split('T')[0];
|
||||||
|
|
||||||
// Filter for PPRs departed today
|
// Filter for PPRs departed today (only PPR'd departures, exclude local/circuits)
|
||||||
const departed = allPPRs.filter(ppr => {
|
const departed = allPPRs.filter(ppr => {
|
||||||
if (!ppr.departed_dt || ppr.status !== 'DEPARTED') {
|
if (!ppr.departed_dt || ppr.status !== 'DEPARTED') {
|
||||||
return false;
|
return false;
|
||||||
@@ -1597,21 +1596,7 @@
|
|||||||
return departedDate === today;
|
return departedDate === today;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Add local flights departed today
|
// Add departures to other airports that departed today (booked out departures)
|
||||||
if (localResponse.ok) {
|
|
||||||
const localFlights = await localResponse.json();
|
|
||||||
const localDeparted = localFlights.filter(flight => {
|
|
||||||
if (!flight.departed_dt) return false;
|
|
||||||
const departedDate = flight.departed_dt.split('T')[0];
|
|
||||||
return departedDate === today;
|
|
||||||
}).map(flight => ({
|
|
||||||
...flight,
|
|
||||||
isLocalFlight: true
|
|
||||||
}));
|
|
||||||
departed.push(...localDeparted);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add departures to other airports that departed today
|
|
||||||
if (depResponse.ok) {
|
if (depResponse.ok) {
|
||||||
const depFlights = await depResponse.json();
|
const depFlights = await depResponse.json();
|
||||||
const depDeparted = depFlights.filter(flight => {
|
const depDeparted = depFlights.filter(flight => {
|
||||||
|
|||||||
Reference in New Issue
Block a user