diff --git a/src/main/java/com/conveyal/datatools/manager/models/FeedSourceSummary.java b/src/main/java/com/conveyal/datatools/manager/models/FeedSourceSummary.java index b9917e94a..9cf031df7 100644 --- a/src/main/java/com/conveyal/datatools/manager/models/FeedSourceSummary.java +++ b/src/main/java/com/conveyal/datatools/manager/models/FeedSourceSummary.java @@ -200,10 +200,10 @@ public static Map getLatestFeedVersionForFeedSources unwind("$feedVersions"), group( "$_id", - Accumulators.first("feedVersionId", "$feedVersions._id"), - Accumulators.first("firstCalendarDate", "$feedVersions.validationResult.firstCalendarDate"), - Accumulators.first("lastCalendarDate", "$feedVersions.validationResult.lastCalendarDate"), - Accumulators.first("errorCount", "$feedVersions.validationResult.errorCount") + Accumulators.last("feedVersionId", "$feedVersions._id"), + Accumulators.last("firstCalendarDate", "$feedVersions.validationResult.firstCalendarDate"), + Accumulators.last("lastCalendarDate", "$feedVersions.validationResult.lastCalendarDate"), + Accumulators.last("errorCount", "$feedVersions.validationResult.errorCount") ) ); return extractFeedVersionSummaries( diff --git a/src/main/java/com/conveyal/datatools/manager/models/FeedVersion.java b/src/main/java/com/conveyal/datatools/manager/models/FeedVersion.java index 44cf2dc04..060f8589b 100644 --- a/src/main/java/com/conveyal/datatools/manager/models/FeedVersion.java +++ b/src/main/java/com/conveyal/datatools/manager/models/FeedVersion.java @@ -365,7 +365,7 @@ public void validate(MonitorableJob.Status status) { status.update("Validating feed...", 33); // Validate the feed version. - // Certain extensions, if enabled, have extra validators + // Certain extensions, if enabled, have extra validators. if (isExtensionEnabled("mtc")) { validationResult = GTFS.validate(feedLoadResult.uniqueIdentifier, DataManager.GTFS_DATA_SOURCE, RouteTypeValidatorBuilder::buildRouteValidator, @@ -384,9 +384,12 @@ public void validate(MonitorableJob.Status status) { to support proprietary features. */ JDBCFetcher feedFetcher = new JDBCFetcher("feed_info"); - Object gtfsFeedId = feedFetcher.getResults(this.namespace, null, null).get(0).get("feed_id"); - - + Object gtfsFeedId = new Object(); + try { + gtfsFeedId = feedFetcher.getResults(this.namespace, null, null).get(0).get("feed_id"); + } catch (RuntimeException e) { + LOG.warn("RuntimeException occurred while fetching feedId"); + } String feedId = gtfsFeedId == null ? "" : gtfsFeedId.toString(); SharedStopsValidator ssv = new SharedStopsValidator(fs.retrieveProject(), feedId);