-
Notifications
You must be signed in to change notification settings - Fork 6
fix: 534 related schedule and realtime feeds dont update when changed #1501
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
fix: 534 related schedule and realtime feeds dont update when changed #1501
Conversation
…-update-when-changed
api/src/scripts/populate_db_gtfs.py
Outdated
| gtfs_rt_feed = self.query_feed_by_stable_id(session, stable_id, "gtfs_rt") | ||
| gtfs_rt_feed = self.query_feed_by_stable_id(session, stable_id, "gtfs_rt") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these two lines are duplicates
api/src/scripts/populate_db_gtfs.py
Outdated
| # Wipe any previously persisted raw static_reference on the ORM (avoid stale data) | ||
| if hasattr(gtfs_rt_feed, "static_reference") and gtfs_rt_feed.static_reference is not None: | ||
| gtfs_rt_feed.static_reference = None | ||
| session.add(gtfs_rt_feed) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[question] this feed is already in the db (just queried) - any reason we need to add it again?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, that's obsolete code that should've be removed.
api/src/scripts/populate_db_gtfs.py
Outdated
| gtfs_rt_feed = self.query_feed_by_stable_id(session, stable_id, "gtfs_rt") | ||
|
|
||
| # Wipe any previously persisted raw static_reference on the ORM (avoid stale data) | ||
| if hasattr(gtfs_rt_feed, "static_reference") and gtfs_rt_feed.static_reference is not None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If i understand properly, the gtfs_rt_feed variable is of type [Gtfsrealtimefeed | None]. The Gtfsrealtimefeed entity never has a static_reference attribute. The attribute is gtfs_feeds.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch!
| default: true | ||
| type: boolean | ||
| repository_dispatch: # Update on mobility-database-catalog repo dispatch | ||
| types: [ catalog-sources-updated, gbfs-systems-updated ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there anything changed in this file except for formatting? If not I suggest in the future that you do not commit a file like that because it looks like it's part of the solution but it has nothing to do with it. IMO
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are right, I disabled format-on-save in my VSCode and reverted the changes.
…-update-when-changed
…n-changed' of github.com:MobilityData/mobility-feed-api into 534-related-schedule-and-realtime-feeds-dont-update-when-changed
jcpitre
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
…-update-when-changed
…#1501) * changed feed references logic
Summary:
Overwrite rt's static references with the newest matches.
Closes #534
Expected behavior:
Explain and/or show screenshots for how you expect the pull request to work in your testing (in case other devices exhibit different behavior).
Testing tips:
Provide tips, procedures and sample files on how to test the feature.
Testers are invited to follow the tips AND to try anything they deem relevant outside the bounds of the testing tips.
Please make sure these boxes are checked before submitting your pull request - thanks!
./scripts/api-tests.shto make sure you didn't break anything