-
Notifications
You must be signed in to change notification settings - Fork 88
fix(saveEntity, saveTripsForCalendar): Resolve missing defaults with GTFS spec changes #720
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(saveEntity, saveTripsForCalendar): Resolve missing defaults with GTFS spec changes #720
Conversation
binh-dam-ibigroup
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.
Getting in the right direction. The remaining gap is to initialize the feed email and URL fields in UI. See also other comments.
| import {saveTripPattern} from './tripPattern' | ||
| import {newGtfsEntity, fetchBaseGtfs} from './editor' | ||
|
|
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.
Can these imports be before the import type or is this something prettier automatically format?
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.
This was an automatic format
| defaults.feed_contact_url = '' | ||
| defaults.feed_contact_email = '' |
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 fields make it to the database, but on page reload are not populated in the UI. Can you fix this?
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.
This was a problem with the fetchBaseGTFS method, which did not fetch the new fields. Fixed in c48bb18
lib/editor/actions/trip.js
Outdated
| trips = trips.map(snakeCaseKeys) | ||
| return Promise.all(trips.filter(t => t).map((trip, index) => { | ||
| const tripExists = !entityIsNew(trip) && trip.id !== null | ||
| const tripCopy: any = (trip: any) |
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.
I would clone it (otherwise you are improperly overwrite data).
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.
Cloned in c48bb18
| return Promise.all(trips.filter(t => t).map((trip, index) => { | ||
| const tripExists = !entityIsNew(trip) && trip.id !== null | ||
| const tripCopy: any = (trip: any) | ||
| // Add default value to continuous pickup if not provided |
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.
Add comment saying editing continuous pickup/drop off is not currently supported in the schedule editor.
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.
Added in c48bb18
…fields, address comments
binh-dam-ibigroup
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, thank you for working on this.
|
Passing this on to @miles-grant-ibigroup for review |
miles-grant-ibigroup
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.
Great patch! Well done finding that error.
Closes #716, #717. New fields added with the changes to the GTFS spec (#668) are missing from old feeds when a GTFS entity is saved, producing a
field missing from JSON objecterror. Fixed by providing default values which are overridden if the feed provides its own values for the new fields.Checklist
devbefore they can be merged tomaster)