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

nycbus: fix schema usage and some small improvements #232

Merged
merged 1 commit into from
Mar 5, 2022

Conversation

samandmoore
Copy link
Contributor

  • fix issue reading stop_code from LocationBased schema
  • ensure time.now is always in new york time zone
  • do some more logging if there's an issue with the json response
  • show something when there's no buses
  • gracefully handle when there's only one bus

regular
image

one bus
image

no buses
image

fixes #231
cc @rohansingh

* fix issue reading stop_code from LocationBased schema
* ensure time.now is always in new york time zone
* do some more logging if there's an issue with the json response
* show something when there's no buses
* gracefully handle when there's only one bus
if stop_code == None:
stop_code = EXAMPLE_STOP_CODE
else:
stop_code = json.decode(stop_code)["value"]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is the relevant bit for #231


if api_key:
journeys = get_journeys(api_key, stop_code)
else:
journeys = PREVIEW_DATA

first_journey = journeys[0]
second_journey = journeys[1]
if journeys == None or len(journeys) == 0:
Copy link
Member

Choose a reason for hiding this comment

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

Python shorthand for this:

Suggested change
if journeys == None or len(journeys) == 0:
if not journeys:

Copy link
Contributor

@betterengineering betterengineering left a comment

Choose a reason for hiding this comment

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

Thanks for the fixes @samandmoore! So sorry for not reaching out about the changes needed. Will give this a go and follow up on the issue once it's out.

@betterengineering betterengineering merged commit bebfa5a into tidbyt:main Mar 5, 2022
@samandmoore
Copy link
Contributor Author

Thanks for merging. No worries. I know y'all are probably quite busy. I'm happy I can contribute! Hopefully it works this time 😅

@tidbyt tidbyt locked as resolved and limited conversation to collaborators Mar 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NYC bus app not showing up in app yet
3 participants