sw-tools / checkin-service

Checks the user in to a flight
MIT License
9 stars 3 forks source link

Support for round-trip flights #5

Closed waffle267 closed 2 years ago

waffle267 commented 2 years ago

This service has been working well for me recently, thank you again! I found one issue however - it looks like the current logic will always select the earliest leg of a reservation. For a round-trip flight, this can be problematic, since we need to schedule the check-in for the return flight, but the earliest leg of the reservation is the outbound flight.

Would it be reasonable to limit validLegs in findFirstLegDate to flight legs that are in the future?

aaron-pham commented 2 years ago

I may open a PR to add support for this.

It seems like instead of returning the first validLeg, we should return the entire array of valid legs and schedule them all upfront. Do you see any issues with this approach? You'd only need to schedule your check in for a reservation once, and all your flights under that reservation should be covered.

swtools0 commented 2 years ago

A PR would be welcomed and appreciated. Otherwise, I'll write the PR myself. It's a great idea.

I agree with the approach of scheduling all future legs up front. findFirstLegDate should be re-written (and re-named) to return all legs whose departure times are >= 5 minutes in the future.

aaron-pham commented 2 years ago

Working on this now! Should have an initial PR out in a few hours.

swtools0 commented 2 years ago

Resolved by #6. Thanks @aaron-pham!