Skip to content

Commit

Permalink
improvement(snapshots): add preserve stop times flag to avoid normali…
Browse files Browse the repository at this point in the history
…zing stop_sequence

re conveyal/gtfs-lib#283
  • Loading branch information
landonreed committed Apr 23, 2020
1 parent 4d110f9 commit 2f309e8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
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;
}

// 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.
*/
public boolean preserveStopTimes;

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

0 comments on commit 2f309e8

Please sign in to comment.