New Flight results and selection strategy
- Major purpose is to implement domestic return flights
- It's future proof for international flights if we introduce the same strategy
- Most of the implementation is generic to support all the route types.
Some important terms
oneway itinerary: A flight with one leg
combo: A flight with two or more legs
hash: It is a key computed at frontend to identify matching itineraries <departure time + arrival time + flight number>
What's the new domestic return flights feature?
Previously we used to have oneway itineraries for return flight.
Now in domestic return flights we get both oneway and return(we call combo) itineraries.
Some new paramters introduced
- comboPrice
- isComboPrice
- hasIndividualReturnPair
Results filtration by selection
If the current leg result is oneway itinerary
- If selected item is combo, we find a oneway selection and show the result only if oneway option is available and update the comboPrice by adding the selling fare of the item and the oneway itinerary.
- If selected item is not a combo, we sum the selling fare of oneway itinerary and the selected result
If current leg is a combo
- We compare by hash keys of the selected result legs with the current result's legs and filters those which have the same hash properties for all the legs.
Flights selection
If we do not have any selected results, we push the result to selected items.
If we have a selection, there're two cases:
- If previous selection and current selection are a combo, we take the current selection, and merge the legs of previous selection into it.
- If previous selection is a combo, but current is a oneway, we find a oneway itinerary that matches the hash(previously explained) of the first leg of first selected item, replace the first item with that oneway and second item is our current oneway selection.
Any Questions?
React Reconciliation
By shahnawaz19415
React Reconciliation
- 105