From cf157656f42e1ea940c7861e1d9a7846c3581ce7 Mon Sep 17 00:00:00 2001 From: april Date: Mon, 15 Jan 2024 15:27:39 -0600 Subject: [PATCH] Handle missing hobbs value --- api/database/flights.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/database/flights.py b/api/database/flights.py index b491a07..b50c7ed 100644 --- a/api/database/flights.py +++ b/api/database/flights.py @@ -203,7 +203,7 @@ async def update_flight(body: FlightCreateSchema, id: str) -> str: raise HTTPException(404, "Aircraft not found") # Update hobbs of aircraft to reflect new hobbs end - if body.hobbs_end > 0 and body.hobbs_end != aircraft.hobbs: + if body.hobbs_end and body.hobbs_end and 0 < aircraft.hobbs != body.hobbs_end: await update_aircraft_field("hobbs", body.hobbs_end, aircraft.id) # Update flight in database