Skip to content

Commit

Permalink
Summarize feed only after adding all errors
Browse files Browse the repository at this point in the history
  • Loading branch information
abyrd committed Jan 20, 2022
1 parent 9595319 commit 75adce5
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,7 @@ private Bundle create (Request req, Response res) {
feed.progressListener = progressListener;
feed.loadFromFile(zipFile, new ObjectId().toString());

// Populate the metadata while the feed is open
// TODO also get service range, hours per day etc. and error summary (and complete error JSON).
Bundle.FeedSummary feedSummary = new Bundle.FeedSummary(feed, bundle.feedGroupId);
bundle.feeds.add(feedSummary);

// Find and validate the extents of the GTFS, defined by all stops in the feed.
for (Stop s : feed.stops.values()) {
bundleBounds.expandToInclude(s.stop_lon, s.stop_lat);
}
Expand All @@ -218,6 +214,12 @@ private Bundle create (Request req, Response res) {
feed.errors.add(new GeneralError("stops", -1, null, iae.getMessage()));
}

// Populate the metadata while the feed is still open.
// This must be done after all errors have been added to the feed.
// TODO also get service range, hours per day etc. and error summary (and complete error JSON).
Bundle.FeedSummary feedSummary = new Bundle.FeedSummary(feed, bundle.feedGroupId);
bundle.feeds.add(feedSummary);

if (bundle.serviceStart.isAfter(feedSummary.serviceStart)) {
bundle.serviceStart = feedSummary.serviceStart;
}
Expand Down

0 comments on commit 75adce5

Please sign in to comment.