auto-sync: 2026-04-21 01:20:01
This commit is contained in:
@@ -215,10 +215,17 @@ def _parse_item(item: Dict, direction: str, airport_iata: str) -> Optional[Dict]
|
||||
|
||||
if duration_min is None and direction == "arrival":
|
||||
dep_dt = _parse_dt(item.get("departure"))
|
||||
arr_dt = _parse_dt(item.get("arrival"))
|
||||
# For arrival records, 'arrival' field is often None,
|
||||
# but scheduled_at IS the arrival time in this airport
|
||||
arr_dt = _parse_dt(item.get("arrival")) or scheduled_at
|
||||
if dep_dt and arr_dt and arr_dt > dep_dt:
|
||||
duration_min = (arr_dt - dep_dt).total_seconds() / 60.0
|
||||
|
||||
if duration_min is None and direction == "departure":
|
||||
# For departure records, 'arrival' field is None,
|
||||
# but we can try to find the matching arrival record later via SQL
|
||||
pass
|
||||
|
||||
return {
|
||||
"flight_number": flight_number,
|
||||
"airline_iata": carrier.get("code"),
|
||||
|
||||
Reference in New Issue
Block a user