diff --git a/src/tam/courses.js b/src/tam/courses.js index e64a280..510bd2f 100644 --- a/src/tam/courses.js +++ b/src/tam/courses.js @@ -1,5 +1,10 @@ -const path = require("path"); -const fs = require("fs").promises; +/** + * @fileoverview + * + * Fetch and aggregate information about vehicles in transit on the TaM network + * from the official endpoints. + */ + const tam = require("./sources/tam"); const network = require("./network.json"); @@ -112,8 +117,12 @@ const fetch = async (kind = 'realtime') => { ) ); + const lastPassing = course.passings[course.passings.length - 1]; + if (course.finalStopId === undefined) { - course.finalStopId = course.passings[course.passings.length - 1][0]; + course.finalStopId = lastPassing[0]; + } else if (course.finalStopId !== lastPassing[0]) { + course.passings.push([course.finalStopId, lastPassing[1] + 30000]); } }