mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-17 07:50:31 +00:00
Add updated test cases and update call to stop arrival helper
This commit is contained in:
@@ -437,12 +437,15 @@ export class RedisShuttleRepository extends EventEmitter implements ShuttleGette
|
||||
}
|
||||
}
|
||||
|
||||
public async getArrivedStopIfExists(shuttle: IShuttle): Promise<IStop | undefined> {
|
||||
public async getArrivedStopIfExists(
|
||||
shuttle: IShuttle,
|
||||
delta = 0.001,
|
||||
): Promise<IStop | undefined> {
|
||||
const orderedStops = await this.getOrderedStopsByRouteId(shuttle.routeId);
|
||||
|
||||
for (const orderedStop of orderedStops) {
|
||||
const stop = await this.getStopById(orderedStop.stopId);
|
||||
if (stop != null && shuttleHasArrivedAtStop(shuttle, stop)) {
|
||||
if (stop != null && shuttleHasArrivedAtStop(shuttle, stop, delta)) {
|
||||
return stop;
|
||||
}
|
||||
return undefined;
|
||||
@@ -454,7 +457,7 @@ export class RedisShuttleRepository extends EventEmitter implements ShuttleGette
|
||||
throw Error("not implemented");
|
||||
}
|
||||
|
||||
private async updateShuttleLastStopArrival(shuttle: IShuttle, lastStopArrival: ShuttleStopArrival) {
|
||||
public async updateShuttleLastStopArrival(shuttle: IShuttle, lastStopArrival: ShuttleStopArrival) {
|
||||
// Key: shuttleId:stopId:
|
||||
// Value: just a marker (no numerical value)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user