diff --git a/src/loaders/shuttle/ApiBasedShuttleRepositoryLoader.ts b/src/loaders/shuttle/ApiBasedShuttleRepositoryLoader.ts index fb7352a..9d8126d 100644 --- a/src/loaders/shuttle/ApiBasedShuttleRepositoryLoader.ts +++ b/src/loaders/shuttle/ApiBasedShuttleRepositoryLoader.ts @@ -159,7 +159,7 @@ export class ApiBasedShuttleRepositoryLoader implements ShuttleRepositoryLoader public async updateShuttleDataForSystemBasedOnProximityToRoutes() { try { const json = await this.fetchShuttleDataJson(); - let shuttles = this.constructShuttlesFromJson(json); + let shuttles = this.constructInServiceShuttlesFromJson(json); if (shuttles !== null) { shuttles = await this.filterShuttlesByDistanceFromCorrespondingRoute(shuttles); await this.updateShuttleDataInRepository(shuttles); @@ -210,11 +210,12 @@ export class ApiBasedShuttleRepositoryLoader implements ShuttleRepositoryLoader return await response.json(); } - private constructShuttlesFromJson(json: any): IShuttle[] | null { + private constructInServiceShuttlesFromJson(json: any): IShuttle[] | null { if (json.buses && json.buses["-1"] === undefined) { const jsonBuses = Object.values(json.buses).map((busesArr: any) => { return busesArr[0]; }); + jsonBuses.filter((bus) => bus.outOfService != 0) return jsonBuses.map((jsonBus: any) => { const constructedShuttle: IShuttle = {