Call getArrivedStopIfExists based on different parameter

This commit is contained in:
2025-11-21 10:56:48 -08:00
parent 712e311006
commit 8c341e91e0
2 changed files with 21 additions and 2 deletions

View File

@@ -369,7 +369,16 @@ export class RedisShuttleRepository extends BaseRedisRepository implements Shutt
travelTimeTimestamp = Date.now(), travelTimeTimestamp = Date.now(),
) { ) {
const isAtStop = await this.checkIfShuttleIsAtStop(shuttle.id); const isAtStop = await this.checkIfShuttleIsAtStop(shuttle.id);
const arrivedStop = await this.getArrivedStopIfExists(shuttle);
let arrivedStop: IStop | undefined;
if (isAtStop) {
// Allow retrieval of the same stop
// Will still return undefined when the shuttle leaves the stop
arrivedStop = await this.getArrivedStopIfExists(shuttle, false);
} else {
arrivedStop = await this.getArrivedStopIfExists(shuttle, true);
}
// Will not fire *any* events if the same stop // Will not fire *any* events if the same stop
const lastStop = await this.getShuttleLastStopArrival(shuttle.id); const lastStop = await this.getShuttleLastStopArrival(shuttle.id);

View File

@@ -184,7 +184,17 @@ export class UnoptimizedInMemoryShuttleRepository
travelTimeTimestamp = Date.now(), travelTimeTimestamp = Date.now(),
) { ) {
const isAtStop = await this.checkIfShuttleIsAtStop(shuttle.id); const isAtStop = await this.checkIfShuttleIsAtStop(shuttle.id);
const arrivedStop = await this.getArrivedStopIfExists(shuttle);
let arrivedStop: IStop | undefined;
if (isAtStop) {
// Allow retrieval of the same stop
// Will still return undefined when the shuttle leaves the stop
arrivedStop = await this.getArrivedStopIfExists(shuttle, false);
} else {
arrivedStop = await this.getArrivedStopIfExists(shuttle, true);
}
// Will not fire *any* events if the same stop // Will not fire *any* events if the same stop
const lastStop = await this.getShuttleLastStopArrival(shuttle.id); const lastStop = await this.getShuttleLastStopArrival(shuttle.id);