Skip to content

Commit 7840ec8

Browse files
authored
Fix invalid gtfs file caused by agencies not in hardcoded list (#95)
The timetable can contain routes not in the hardcoded list in agencies.ts. In particular I've seen QH, QR, QU, and QV in the national rail data portal timetable. This commit exports such routes using the existing 'ZZ' - Other operator agency.
1 parent a78992b commit 7840ec8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/gtfs/repository/ScheduleBuilder.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import moment = require("moment");
55
import {ScheduleCalendar} from "../native/ScheduleCalendar";
66
import {ScheduleStopTimeRow} from "./CIFRepository";
77
import {StopTime} from "../file/StopTime";
8+
import { agencies } from "../../../config/gtfs/agency";
89

910
const pickupActivities = ["T ", "TB", "U "];
1011
const dropOffActivities = ["T ", "TF", "D "];
@@ -88,7 +89,7 @@ export class ScheduleBuilder {
8889
}
8990
),
9091
mode,
91-
row.atoc_code,
92+
agencies.some((a) => a.agency_id === row.atoc_code) ? row.atoc_code : "ZZ",
9293
row.stp_indicator,
9394
mode === RouteType.Rail && row.train_class !== "S",
9495
row.reservations !== null

0 commit comments

Comments
 (0)