From 90973067f47da909f6964f3f9b3783a66c6faab6 Mon Sep 17 00:00:00 2001 From: Spythere Date: Thu, 27 Jan 2022 15:39:55 +0100 Subject: [PATCH] =?UTF-8?q?Dodano=20informacj=C4=99=20o=20op=C3=B3=C5=BAni?= =?UTF-8?q?eniach=20w=20skr=C3=B3conym=20widoku=20listy=20poci=C4=85g?= =?UTF-8?q?=C3=B3w?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/TrainsView/TrainInfo.vue | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/components/TrainsView/TrainInfo.vue b/src/components/TrainsView/TrainInfo.vue index 278111d..73c7bb3 100644 --- a/src/components/TrainsView/TrainInfo.vue +++ b/src/components/TrainsView/TrainInfo.vue @@ -23,6 +23,8 @@ {{ train.timetableData.routeDistance }} km | {{ confirmedPercentage(train.timetableData.followingStops) }}% trasy + | + @@ -241,6 +243,16 @@ export default defineComponent({ return ((stops.filter((stop) => stop.confirmed).length / stops.length) * 100).toFixed(0); }, + currentDelay(stops: TrainStop[]) { + const delay = + stops.find((stop, i) => (i == 0 && !stop.confirmed) || (i > 0 && stops[i - 1].confirmed && !stop.confirmed)) + ?.departureDelay || 0; + + if (delay > 0) return `Opóźniony: ${delay} min`; + else if (delay < 0) return `Przed czasem: ${delay} min`; + else return 'Planowo'; + }, + displayLocoInfo(locoType: string) { if (locoType.includes('EN')) return `${this.$t('trains.EZT')}`; if (locoType.includes('SN')) return `${this.$t('trains.SZT')}`;