BlinkTagInc / gtfs-to-html

Build human readable transit timetables as HTML or PDF from GTFS.

Home Page:https://gtfstohtml.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Crash when using frequencies

harkle opened this issue · comments

Hello. I just seen the script is crashing when using frequencies.txt.

Log

[  ReferenceError: config is not defined


  - utils.js:580
    /Users/harkle/kDrive/Downloads/gtfs-to-html-1.0.8/lib/utils.js:580:77

  - Array.map

  - utils.js:580 getFrequenciesByTrip
    /Users/harkle/kDrive/Downloads/gtfs-to-html-1.0.8/lib/utils.js:580:22

  - utils.js:803
    async /Users/harkle/kDrive/Downloads/gtfs-to-html-1.0.8/lib/utils.js:803:25

  - async Promise.all

  - utils.js:758 async getTripsFromTimetable
    /Users/harkle/kDrive/Downloads/gtfs-to-html-1.0.8/lib/utils.js:758:3

  - utils.js:868
    async /Users/harkle/kDrive/Downloads/gtfs-to-html-1.0.8/lib/utils.js:868:30

  - async Promise.all

  - utils.js:1076 async Object.exports.getFormattedTimetablePage
    /Users/harkle/kDrive/Downloads/gtfs-to-html-1.0.8/lib/utils.js:1076:42

  - gtfs-to-html.js:63
    async /Users/harkle/kDrive/Downloads/gtfs-to-html-1.0.8/lib/gtfs-to-html.js:63:29

  - async Promise.all

]

Fix
Pass config in utils.js Lines 576;580.

const getFrequenciesByTrip = async (trip, config) => {
  const frequencies = await gtfs.getFrequencies({
    trip_id: trip.trip_id
  });
  return frequencies.map(frequency => formatters.formatFrequency(frequency, config));
};

Thanks for reporting this issue.

Could you share with me a link to the GTFS file you are using so I can try this out and push an update with a fix?

Thanks for your reply. Here is the GTFS file: https://kanakosawada.com/gtfs-2.zip

I pushed an update to GTFS-to-HTML version 1.0.9 which solves this issue. Try it out and let me know if you have any other issues.

If you end up using this for anything, let me know if you'd like your agency included in the README list of agencies using GTFS-to-HTML.