From 7840ec81707ba69045dfb45b2e9ea10f51e54e9e Mon Sep 17 00:00:00 2001 From: Daniel Franklin Date: Mon, 5 Aug 2024 20:08:40 +0100 Subject: [PATCH] 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. --- src/gtfs/repository/ScheduleBuilder.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gtfs/repository/ScheduleBuilder.ts b/src/gtfs/repository/ScheduleBuilder.ts index dbefa4cc..9b715e91 100644 --- a/src/gtfs/repository/ScheduleBuilder.ts +++ b/src/gtfs/repository/ScheduleBuilder.ts @@ -5,6 +5,7 @@ import moment = require("moment"); import {ScheduleCalendar} from "../native/ScheduleCalendar"; import {ScheduleStopTimeRow} from "./CIFRepository"; import {StopTime} from "../file/StopTime"; +import { agencies } from "../../../config/gtfs/agency"; const pickupActivities = ["T ", "TB", "U "]; const dropOffActivities = ["T ", "TF", "D "]; @@ -88,7 +89,7 @@ export class ScheduleBuilder { } ), mode, - row.atoc_code, + agencies.some((a) => a.agency_id === row.atoc_code) ? row.atoc_code : "ZZ", row.stp_indicator, mode === RouteType.Rail && row.train_class !== "S", row.reservations !== null