From c0ad505a2cdc37bc71d8197457657134baabdc4f Mon Sep 17 00:00:00 2001 From: Dimitar <19364673+Dimitar5555@users.noreply.github.com> Date: Mon, 3 Feb 2025 22:59:21 +0200 Subject: [PATCH] add route indexes to stops --- build.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/build.js b/build.js index a6272bd..eb1fbb3 100644 --- a/build.js +++ b/build.js @@ -119,6 +119,22 @@ async function fetch_all_data() { // sort directions by code directions.sort((a, b) => a.code - b.code); + + // add route indexes to stops + for(const direction of directions) { + const route_index = trips.find(trip => trip.direction == direction.code).route_index; + for(const stop_code of direction.stops) { + const stop = stops.find(stop => stop.code == stop_code); + if(stop) { + if(!stop.route_indexes) { + stop.route_indexes = []; + } + if(!stop.route_indexes.includes(route_index)) { + stop.route_indexes.push(route_index); + } + } + } + } var files_to_save = [ {