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

Add preserve stop times flag to avoid normalizing stop_sequence #304

Merged
merged 5 commits into from
May 19, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public void jobLogic() {
Collection<Snapshot> existingSnapshots = feedSource.retrieveSnapshots();
int version = existingSnapshots.size();
status.update("Creating snapshot...", 20);
FeedLoadResult loadResult = makeSnapshot(namespace, DataManager.GTFS_DATA_SOURCE);
FeedLoadResult loadResult = makeSnapshot(namespace, DataManager.GTFS_DATA_SOURCE, !feedSource.preserveStopTimes);
snapshot.version = version;
snapshot.namespace = loadResult.uniqueIdentifier;
snapshot.feedLoadResult = loadResult;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public void jobLogic() {
FeedLoadResult result = exporter.exportTables();
if (result.fatalException != null) {
status.fail(String.format("Error (%s) encountered while exporting database tables.", result.fatalException));
return;
landonreed marked this conversation as resolved.
Show resolved Hide resolved
}

// Override snapshot ID if exporting feed for use as new feed version.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,17 @@ public class FeedSource extends Model implements Cloneable {
/**
* The collection of which this feed is a part
*/
//@JsonView(JsonViews.DataDump.class)
public String projectId;

/**
* When snapshotting a GTFS feed for editing, gtfs-lib currently defaults to normalize stop sequence values to be
* zero-based and incrementing. This can muck with GTFS files that are linked to GTFS-rt feeds by stop_sequence, so
* this override flag currently provides a workaround for feeds that need to be edited but do not need to edit
* stop_times or individual patterns. WARNING: enabling this flag for a feed and then attempting to edit patterns in
* complicated ways (e.g., modifying the order of pattern stops) could have unexpected consequences.
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like it'd be good to have some kind of UI warning for this.

Copy link
Contributor

Choose a reason for hiding this comment

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

oh, just read the PR description. Maybe edit this comment to say that there is no UI setting for this and it is not recommended to do this unless absolutely necessary.

*/
public boolean preserveStopTimes;
Copy link
Contributor

Choose a reason for hiding this comment

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

Rename to preserveStopTimesSequence and simplify the comment above.


/**
* Get the Project of which this feed is a part
*/
Expand Down