mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-19 08:50:29 +00:00
Prevent shuttle arriving at same stop from firing the SHUTTLE_WILL_ARRIVE_AT_STOP event
This commit is contained in:
@@ -93,6 +93,9 @@ export class InMemorySelfUpdatingETARepository extends BaseInMemoryETARepository
|
||||
private async handleShuttleWillArriveAtStop(shuttleArrival: ShuttleStopArrival): Promise<void> {
|
||||
const lastStopTimestamp = await this.shuttleRepository.getShuttleLastStopArrival(shuttleArrival.shuttleId);
|
||||
if (lastStopTimestamp) {
|
||||
// disallow cases where this gets triggered multiple times
|
||||
if (lastStopTimestamp.stopId === shuttleArrival.stopId) return;
|
||||
|
||||
const shuttle = await this.shuttleRepository.getShuttleById(lastStopTimestamp.shuttleId);
|
||||
if (!shuttle) return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user