From 95e1da1c66919e2eebdc43c772dbe1fc4e80d1d0 Mon Sep 17 00:00:00 2001 From: Spythere Date: Wed, 19 Jan 2022 04:18:26 +0100 Subject: [PATCH] =?UTF-8?q?Lista=20poci=C4=85g=C3=B3w:=20usprawnienie=20fi?= =?UTF-8?q?ltrowania?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/index.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/store/index.ts b/src/store/index.ts index 96f1ab3..08cc9dc 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -479,6 +479,10 @@ export const store = createStore({ state.trainList = state.trainList.reduce((acc, train) => { const timetableData = timetableList.find(data => data && data.trainNo === train.trainNo && data.driverId === train.driverId); + const allTimetables = timetableList.filter(data => data && data.driverId === train.driverId && data.trainNo !== train.trainNo); + + if (allTimetables.length > 0) + return acc; const trainStopData = state.stationList .find(station => station.name === train.currentStationName)