From 9cdb1114c4610bf600c103eccab7860b0c12cf3c Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Thu, 14 Nov 2024 09:34:48 +0200 Subject: [PATCH 1/2] fix: unique id for departure rows --- app/component/DepartureListContainer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/component/DepartureListContainer.js b/app/component/DepartureListContainer.js index a39e3bcca8..004cdeed4d 100644 --- a/app/component/DepartureListContainer.js +++ b/app/component/DepartureListContainer.js @@ -314,7 +314,7 @@ class DepartureListContainer extends Component { ); } - const id = `${departure.pattern.code}:${departure.stoptime}`; + const id = `${departure.pattern.code}:${departure.stoptime}:${departure.trip.gtfsId}`; const dropoffMessage = getDropoffMessage( departure.hasOnlyDropoff, departure.hasNoStop, From 4f32ecd82f20b84147536884bbebd3461c98deb0 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Thu, 14 Nov 2024 09:40:37 +0200 Subject: [PATCH 2/2] fix: don't call everything as stoptime --- app/component/DepartureListContainer.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/app/component/DepartureListContainer.js b/app/component/DepartureListContainer.js index 004cdeed4d..01fc2612ed 100644 --- a/app/component/DepartureListContainer.js +++ b/app/component/DepartureListContainer.js @@ -51,7 +51,7 @@ const asDepartures = stoptimes => (!canceled ? stoptime.realtimeDeparture : stoptime.scheduledDeparture); - const stoptimeTime = isArrival ? arrivalTime : departureTime; + const time = isArrival ? arrivalTime : departureTime; const { pattern } = stoptime.trip; return { @@ -60,7 +60,7 @@ const asDepartures = stoptimes => hasNoStop, hasOnlyDropoff, isLastStop, - stoptime: stoptimeTime, + time, stop: stoptime.stop, realtime: stoptime.realtime, pattern, @@ -246,7 +246,7 @@ class DepartureListContainer extends Component { let dayCutoff = moment.unix(currentTime).startOf('day').unix(); const departures = asDepartures(stoptimes) .filter(departure => !(isTerminal && departure.isArrival)) - .filter(departure => currentTime < departure.stoptime) + .filter(departure => currentTime < departure.time) .slice(0, limit); // Add day dividers when day changes and add service day divider after service day changes. @@ -254,13 +254,13 @@ class DepartureListContainer extends Component { const departuresWithDayDividers = departures.map(departure => { const serviceDate = moment.unix(departure.serviceDay).format('DDMMYYYY'); const dayCutoffDate = moment.unix(dayCutoff).format('DDMMYYYY'); - const stoptimeDate = moment.unix(departure.stoptime).format('DDMMYYYY'); + const date = moment.unix(departure.time).format('DDMMYYYY'); const serviceDayCutoffDate = moment .unix(serviceDayCutoff) .format('DDMMYYYY'); - if (stoptimeDate !== dayCutoffDate && departure.stoptime > dayCutoff) { - dayCutoff = moment.unix(departure.stoptime).startOf('day').unix(); + if (date !== dayCutoffDate && departure.time > dayCutoff) { + dayCutoff = moment.unix(departure.time).startOf('day').unix(); // eslint-disable-next-line no-param-reassign departure.addDayDivider = true; } @@ -283,14 +283,14 @@ class DepartureListContainer extends Component { let firstDayDepartureCount = 0; departuresWithDayDividers.forEach((departure, index) => { - const departureDate = moment.unix(departure.stoptime).format('DDMMYYYY'); + const departureDate = moment.unix(departure.time).format('DDMMYYYY'); const nextDay = moment.unix(currentTime).add(1, 'day').unix(); - if (departure.stoptime < nextDay) { + if (departure.time < nextDay) { firstDayDepartureCount += 1; } // If next 24h has more than 10 departures only show stops for the next 24h - if (departure.stoptime > nextDay && firstDayDepartureCount >= 10) { + if (departure.time > nextDay && firstDayDepartureCount >= 10) { return; } @@ -299,7 +299,7 @@ class DepartureListContainer extends Component {
- {moment.unix(departure.stoptime).format('dddd D.M.YYYY')} + {moment.unix(departure.time).format('dddd D.M.YYYY')}
, @@ -314,7 +314,7 @@ class DepartureListContainer extends Component { ); } - const id = `${departure.pattern.code}:${departure.stoptime}:${departure.trip.gtfsId}`; + const id = `${departure.pattern.code}:${departure.time}:${departure.trip.gtfsId}`; const dropoffMessage = getDropoffMessage( departure.hasOnlyDropoff, departure.hasNoStop, @@ -344,7 +344,7 @@ class DepartureListContainer extends Component {