Small bugfixes

This commit is contained in:
2025-12-18 08:10:57 -05:00
parent a2682314c9
commit d183678282
3 changed files with 22 additions and 39 deletions

View File

@@ -4,6 +4,7 @@ from sqlalchemy import and_, or_, func, desc
from datetime import date, datetime
import secrets
from app.models.ppr import PPRRecord, PPRStatus
from app.models.journal import EntityType
from app.schemas.ppr import PPRCreate, PPRUpdate
from app.crud.crud_journal import journal as crud_journal
@@ -89,6 +90,7 @@ class CRUDPPR:
# Log creation in journal
crud_journal.log_change(
db,
EntityType.PPR,
db_obj.id,
f"PPR created for {db_obj.ac_reg}",
created_by,

View File

@@ -63,6 +63,14 @@ http {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# WebSocket timeout settings (prevent connection drops)
proxy_read_timeout 3600s;
proxy_send_timeout 3600s;
proxy_connect_timeout 60s;
# Additional WebSocket connection settings
proxy_buffering off;
}
# Security headers

View File

@@ -990,7 +990,7 @@
// Refresh local flights when any local flight event occurs
if (data.type && (data.type.includes('local_flight_'))) {
console.log('Local flight update detected, refreshing...');
loadLocalFlights();
loadPPRs();
showNotification('Local flight updated');
}
@@ -1709,11 +1709,7 @@
document.getElementById('parked-no-data').style.display = 'none';
try {
// Load both PPRs and booked-in arrivals
const [pprResponse, bookedInResponse] = await Promise.all([
authenticatedFetch('/api/v1/pprs/?limit=1000'),
authenticatedFetch('/api/v1/arrivals/?limit=1000')
]);
const pprResponse = await authenticatedFetch('/api/v1/pprs/?limit=1000');
if (!pprResponse.ok) {
throw new Error('Failed to fetch parked visitors');
@@ -1722,33 +1718,19 @@
const allPPRs = await pprResponse.json();
const today = new Date().toISOString().split('T')[0];
// Filter for parked visitors: LANDED status and (no ETD or ETD not today)
// Show all parked aircraft regardless of when they arrived
// Filter for parked PPR visitors: LANDED status and ETD on a different day
const parked = allPPRs.filter(ppr => {
if (ppr.status !== 'LANDED') {
return false;
}
// No ETD means parked
// Only show if ETD exists and is not today
if (!ppr.etd) {
return true;
return false;
}
// ETD exists but is not today
const etdDate = ppr.etd.split('T')[0];
return etdDate !== today;
});
// Add booked-in arrivals with LANDED status
if (bookedInResponse.ok) {
const bookedInArrivals = await bookedInResponse.json();
const bookedInParked = bookedInArrivals
.filter(arrival => arrival.status === 'LANDED')
.map(arrival => ({
...arrival,
isBookedIn: true // Flag to distinguish from PPR
}));
parked.push(...bookedInParked);
}
displayParked(parked);
} catch (error) {
console.error('Error loading parked visitors:', error);
@@ -1793,26 +1775,17 @@
for (const ppr of uniqueParked) {
const row = document.createElement('tr');
const isBookedIn = ppr.isBookedIn;
// Click handler that routes to correct modal/display
if (isBookedIn) {
row.style.cursor = 'default'; // Booked-in arrivals don't have a modal yet
} else {
row.onclick = () => openPPRModal(ppr.id);
}
// All rows are PPR, so make them clickable
row.onclick = () => openPPRModal(ppr.id);
row.style.cssText = 'font-size: 0.85rem !important; font-style: italic;';
// Get registration based on type (PPR vs booked-in)
let registration = ppr.ac_reg || ppr.registration || '-';
let typeIconParked = '';
if (!isBookedIn) {
// Add P icon for PPR flights
typeIconParked = '<span style="color: #032cfc; font-weight: bold;" title="From PPR">P</span>';
}
// Get registration
const registration = ppr.ac_reg || '-';
const typeIconParked = '<span style="color: #032cfc; font-weight: bold;" title="From PPR">P</span>';
// Get aircraft type based on type (PPR vs booked-in)
const acType = ppr.ac_type || ppr.type || '-';
// Get aircraft type
const acType = ppr.ac_type || '-';
// Get from airport
const fromAirport = ppr.in_from || '-';