Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set pickup/drop_off _type on in-seat transfers #21

Merged
merged 4 commits into from
Mar 20, 2024

Conversation

jsteelz
Copy link
Member

@jsteelz jsteelz commented Mar 20, 2024

If a transfer is in_seat, passengers should be able to embark at the last stop of the from_trip of the continuation, and disembark at the first stop of the to_trip of the continuation. Update the stop_times to reflect this.

Update a simple test case to ensure that this transformation is applied.

If a transfer is in_seat, passengers should be able to embark at the
last stop of the from_trip of the continuation, and disembark at the
first stop of the to_trip of the continuation. Update the stop_times to
reflect this.

Update a simple test case to ensure that this transformation is applied.
@jsteelz jsteelz requested a review from npaun March 20, 2024 15:59
to_trip_ids_to_set.add(to_trip_id)

for trip_id in from_trip_ids_to_set:
gtfs.stop_times.get(trip_id)[-1].pickup_type = PickupType.REGULARLY_SCHEDULED
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's necessary to use a set to collect trip_ids. You can directly manipulate gtfs.stop_times[from_trip_id] or to_trip_id in the innermost loop.

Regardless, .get(trip_id) should be replaced with [trip_id] this is because .get returns None for unset keys, and will then lead to an exception when you try to operate on it. The brackets will immediately raise an exception indicating that trip_id wasn't found, which is actually the underlying issue.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jsteelz jsteelz requested a review from npaun March 20, 2024 17:27
Comment on lines 4 to 5
from_trip_ids_to_set = set()
to_trip_ids_to_set = set()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These variables have now become unused,

Comment on lines +11 to +12
if not (from_trip_id and to_trip_id):
continue
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if not (from_trip_id and to_trip_id):
continue
if not (from_trip_id and to_trip_id):
continue

I'm not a stickler for it but I usually leave a blank line between different if blocks

Copy link
Contributor

@npaun npaun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution to open source.

@jsteelz jsteelz merged commit 0ea1d23 into master Mar 20, 2024
1 check passed
@jsteelz jsteelz deleted the jsteelz/set-pickup-drop-off-on-in-seat-cont branch March 20, 2024 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants