Skip to content

Commit

Permalink
fix: updating the wrong departure in favorite departures with realtim…
Browse files Browse the repository at this point in the history
…e data (#3699)
  • Loading branch information
mortennordseth committed Jun 30, 2023
1 parent beb13d3 commit bfc7da6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/departure-list/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {DepartureRealtimeData, DeparturesRealtimeData} from '@atb/sdk';
import {isNumberOfMinutesInThePast} from '@atb/utils/date';

export const HIDE_AFTER_NUM_MINUTES = 1;

/***
* Used to update all stops with new time from realtime mapping object returned
* from the BFF. It also removes outdated departures which most likely have passed.
Expand Down Expand Up @@ -83,7 +82,10 @@ function updateDeparturesWithRealtime(

const departureRealtime = realtime.departures[serviceJourneyId];

if (!departureRealtime) {
if (
!departureRealtime ||
departure.aimedTime !== departureRealtime.timeData.aimedDepartureTime
) {
return departure;
}

Expand Down
1 change: 1 addition & 0 deletions src/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ export type RealtimeData = {
timeData: {
realtime: boolean;
expectedDepartureTime: string;
aimedDepartureTime: string;
};
};

Expand Down

0 comments on commit bfc7da6

Please sign in to comment.