Implement removal of last stop data on shuttle removal

This commit is contained in:
2025-11-14 10:26:52 -08:00
parent 1511b3c118
commit f06e778b80
2 changed files with 18 additions and 1 deletions

View File

@@ -267,6 +267,7 @@ export class UnoptimizedInMemoryShuttleRepository
const shuttle = await this.removeEntityByIdIfExists(shuttleId, this.shuttles);
if (shuttle != null) {
this.emit(ShuttleRepositoryEvent.SHUTTLE_REMOVED, shuttle);
await this.removeShuttleLastStopIfExists(shuttleId);
}
return shuttle;
}
@@ -282,6 +283,10 @@ export class UnoptimizedInMemoryShuttleRepository
}, this.orderedStops);
}
private async removeShuttleLastStopIfExists(shuttleId: string) {
this.shuttleLastStopArrivals.delete(shuttleId);
}
public async clearShuttleData(): Promise<void> {
this.shuttles = [];
await this.clearShuttleLastStopData();