Skip to content

Commit 7a5ce48

Browse files
committed
improvement(GtfsPlusController): Update to save validation to related feed version
1 parent a1a056f commit 7a5ce48

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/main/java/com/conveyal/datatools/manager/controllers/api/GtfsPlusController.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,13 +246,22 @@ private static String publishGtfsPlusFile(Request req, Response res) {
246246
}
247247

248248
/**
249-
* HTTP endpoint that validates GTFS+ tables for a specific feed version (or its saved/edited GTFS+).
249+
* HTTP endpoint that validates GTFS+ tables for a specific feed version (or its saved/edited GTFS+). If the feed
250+
* version already has GTFS+ validation results, those will be returned instead of re-validating.
250251
*/
251252
private static GtfsPlusValidation getGtfsPlusValidation(Request req, Response res) {
252253
String feedVersionId = req.params("versionid");
253254
GtfsPlusValidation gtfsPlusValidation = null;
254255
try {
256+
FeedVersion feedVersion = Persistence.feedVersions.getById(feedVersionId);
257+
if (feedVersion != null && feedVersion.gtfsPlusValidation != null) {
258+
return feedVersion.gtfsPlusValidation;
259+
}
255260
gtfsPlusValidation = GtfsPlusValidation.validate(feedVersionId);
261+
if (feedVersion != null) {
262+
feedVersion.gtfsPlusValidation = gtfsPlusValidation;
263+
Persistence.feedVersions.replace(feedVersion.id, feedVersion);
264+
}
256265
} catch(Exception e) {
257266
logMessageAndHalt(req, 500, "Could not read GTFS+ zip file", e);
258267
}

0 commit comments

Comments
 (0)