Skip to content

Commit

Permalink
add route indexes to stops
Browse files Browse the repository at this point in the history
  • Loading branch information
Dimitar5555 committed Feb 3, 2025
1 parent 0f4a468 commit c0ad505
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions build.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
{
Expand Down

0 comments on commit c0ad505

Please sign in to comment.