Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3ba001c

Browse files
fix(FeedVersion, gtfsplus.yml): Add call to MTCValidator, change gtfsplus.yml to match MTC guideline
1 parent 12f8dd5 commit 3ba001c

File tree

2 files changed

+8
-13
lines changed

2 files changed

+8
-13
lines changed

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

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import com.conveyal.gtfs.GTFS;
1111
import com.conveyal.gtfs.loader.Feed;
1212
import com.conveyal.gtfs.loader.FeedLoadResult;
13+
import com.conveyal.gtfs.validator.MTCValidator;
1314
import com.conveyal.gtfs.validator.ValidationResult;
1415
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
1516
import com.fasterxml.jackson.annotation.JsonInclude;
@@ -226,7 +227,7 @@ public void load(MonitorableJob.Status status, boolean isNewVersion) {
226227
File gtfsFile;
227228
// STEP 1. LOAD GTFS feed into relational database
228229
try {
229-
status.update(false,"Unpacking feed...", 15.0);
230+
status.update("Unpacking feed...", 15.0);
230231
// Get SQL schema namespace for the feed version. This is needed for reconnecting with feeds
231232
// in the database.
232233
gtfsFile = retrieveGtfsFile();
@@ -241,19 +242,15 @@ public void load(MonitorableJob.Status status, boolean isNewVersion) {
241242
this.namespace = feedLoadResult.uniqueIdentifier;
242243
LOG.info("Loaded GTFS into SQL {}", feedLoadResult.uniqueIdentifier);
243244
} catch (Exception e) {
244-
String errorString = String.format("Error loading GTFS feed for version: %s", this.id);
245-
LOG.warn(errorString, e);
246-
status.update(true, errorString, 0);
245+
status.fail(String.format("Error loading GTFS feed for version: %s", this.id), e);
247246
// FIXME: Delete local copy of feed version after failed load?
248247
return;
249248
}
250249

251250
// FIXME: is this the right approach?
252251
// if load was unsuccessful, update status and return
253252
if(this.feedLoadResult == null) {
254-
String errorString = String.format("Could not load GTFS for FeedVersion %s", id);
255-
LOG.error(errorString);
256-
status.update(true, errorString, 0);
253+
status.fail(String.format("Could not load GTFS for FeedVersion %s", id));
257254
// FIXME: Delete local copy of feed version after failed load?
258255
return;
259256
}
@@ -313,11 +310,9 @@ public void validate(MonitorableJob.Status status) {
313310
// run validation on feed version
314311
// FIXME: pass status to validate? Or somehow listen to events?
315312
status.update("Validating feed...", 33);
316-
validationResult = GTFS.validate(feedLoadResult.uniqueIdentifier, DataManager.GTFS_DATA_SOURCE);
313+
validationResult = GTFS.validate(feedLoadResult.uniqueIdentifier, DataManager.GTFS_DATA_SOURCE, MTCValidator::new);
317314
} catch (Exception e) {
318-
String message = String.format("Unable to validate feed %s", this.id);
319-
LOG.error(message, e);
320-
status.update(true, message, 100, true);
315+
status.fail(String.format("Unable to validate feed %s", this.id), e);
321316
// FIXME create validation result with new constructor?
322317
validationResult = new ValidationResult();
323318
validationResult.fatalException = "failure!";

src/main/resources/gtfs/gtfsplus.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@
310310
- name: price
311311
required: true
312312
inputType: TEXT
313-
maxLength: 8
313+
maxLength: 6 # MTC: (5,2) number format from 0.00 to 999.99.
314314
columnWidth: 3
315315

316316
- id: calendar_attributes
@@ -338,5 +338,5 @@
338338
- name: zone_name
339339
required: true
340340
inputType: TEXT
341-
maxLength: 35
341+
maxLength: 250
342342
helpContent: Public name of the fare zone, as it should appear on 511.org such as EastBay, WestBay, etc

0 commit comments

Comments
 (0)