Merge remote-tracking branch 'origin/main'

This commit is contained in:
2026-06-28 07:41:54 -04:00
2 changed files with 38 additions and 1 deletions
+3 -1
View File
@@ -187,7 +187,7 @@ class CRUDLocalFlight:
current_time = timestamp if timestamp is not None else datetime.utcnow()
if status == LocalFlightStatus.GROUND:
db_obj.contact_dt = current_time
elif status == LocalFlightStatus.DEPARTED:
elif status == LocalFlightStatus.DEPARTED and not db_obj.departed_dt:
db_obj.departed_dt = current_time
elif status == LocalFlightStatus.LANDED and not db_obj.landed_dt:
db_obj.landed_dt = current_time
@@ -200,6 +200,8 @@ class CRUDLocalFlight:
# Takeoff: happens once when transitioning away from GROUND
if old_status == LocalFlightStatus.GROUND and status in (LocalFlightStatus.DEPARTED, LocalFlightStatus.LOCAL, LocalFlightStatus.CIRCUIT) and not db_obj.takeoff_dt:
db_obj.takeoff_dt = current_time
if not db_obj.departed_dt:
db_obj.departed_dt = current_time
db.add(db_obj)
db.commit()