Major WIP state machine
This commit is contained in:
@@ -144,10 +144,20 @@ class CRUDLocalFlight:
|
||||
old_status = db_obj.status
|
||||
db_obj.status = status
|
||||
|
||||
# Update flight_type based on status changes
|
||||
if status == LocalFlightStatus.LOCAL:
|
||||
db_obj.flight_type = LocalFlightType.LOCAL
|
||||
elif status == LocalFlightStatus.CIRCUIT:
|
||||
db_obj.flight_type = LocalFlightType.CIRCUITS
|
||||
|
||||
# Set timestamps based on status
|
||||
current_time = timestamp if timestamp is not None else datetime.utcnow()
|
||||
if status == LocalFlightStatus.DEPARTED:
|
||||
if status == LocalFlightStatus.GROUND:
|
||||
db_obj.contact_dt = current_time
|
||||
elif status == LocalFlightStatus.DEPARTED:
|
||||
db_obj.departed_dt = current_time
|
||||
elif status == LocalFlightStatus.LOCAL:
|
||||
db_obj.takeoff_dt = current_time
|
||||
elif status == LocalFlightStatus.LANDED:
|
||||
db_obj.landed_dt = current_time
|
||||
# Count circuits from the circuits table and populate the circuits column
|
||||
|
||||
Reference in New Issue
Block a user