Skip to content

Commit 2f309e8

Browse files
committed
improvement(snapshots): add preserve stop times flag to avoid normalizing stop_sequence
re conveyal/gtfs-lib#283
1 parent 4d110f9 commit 2f309e8

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

src/main/java/com/conveyal/datatools/editor/jobs/CreateSnapshotJob.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public void jobLogic() {
8787
Collection<Snapshot> existingSnapshots = feedSource.retrieveSnapshots();
8888
int version = existingSnapshots.size();
8989
status.update("Creating snapshot...", 20);
90-
FeedLoadResult loadResult = makeSnapshot(namespace, DataManager.GTFS_DATA_SOURCE);
90+
FeedLoadResult loadResult = makeSnapshot(namespace, DataManager.GTFS_DATA_SOURCE, !feedSource.preserveStopTimes);
9191
snapshot.version = version;
9292
snapshot.namespace = loadResult.uniqueIdentifier;
9393
snapshot.feedLoadResult = loadResult;

src/main/java/com/conveyal/datatools/editor/jobs/ExportSnapshotToGTFSJob.java

+1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ public void jobLogic() {
5252
FeedLoadResult result = exporter.exportTables();
5353
if (result.fatalException != null) {
5454
status.fail(String.format("Error (%s) encountered while exporting database tables.", result.fatalException));
55+
return;
5556
}
5657

5758
// Override snapshot ID if exporting feed for use as new feed version.

src/main/java/com/conveyal/datatools/manager/models/FeedSource.java

+9-1
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,17 @@ public class FeedSource extends Model implements Cloneable {
4747
/**
4848
* The collection of which this feed is a part
4949
*/
50-
//@JsonView(JsonViews.DataDump.class)
5150
public String projectId;
5251

52+
/**
53+
* When snapshotting a GTFS feed for editing, gtfs-lib currently defaults to normalize stop sequence values to be
54+
* zero-based and incrementing. This can muck with GTFS files that are linked to GTFS-rt feeds by stop_sequence, so
55+
* this override flag currently provides a workaround for feeds that need to be edited but do not need to edit
56+
* stop_times or individual patterns. WARNING: enabling this flag for a feed and then attempting to edit patterns in
57+
* complicated ways (e.g., modifying the order of pattern stops) could have unexpected consequences.
58+
*/
59+
public boolean preserveStopTimes;
60+
5361
/**
5462
* Get the Project of which this feed is a part
5563
*/

0 commit comments

Comments
 (0)