Skip to content

Duplicate flight entries appear in search results #63

@MatheusCyrillo

Description

@MatheusCyrillo

When parsing and appending flights to our results array, the same flight can be added multiple times:

Image

The only difference between one line and the other is the is_best property—does anyone know if it actually makes a difference?

My suggestion is to remove one of the lines:

flights = []
seen_keys = set()

 for i, fl in enumerate(parser.css('div[jsname="IWWDBc"], div[jsname="YdtKid"]')):
     flightkey = (name, departure_time, arrival_time, duration, stops_fmt, delay, price)

     if flightkey in seen_keys :
         continue

     flights_seen.add(flightkey)
     flights.append({ … })

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions