mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-17 07:50:31 +00:00
Update getArrivedStopIfExists method to take an argument returnNextStopOnly
This commit is contained in:
@@ -443,24 +443,14 @@ export class RedisShuttleRepository extends BaseRedisRepository implements Shutt
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the stop that the shuttle is currently at, if it exists.
|
||||
*
|
||||
* If the shuttle has a "last stop", it will only return the stop
|
||||
* directly after the last stop. Otherwise, it may return any stop that
|
||||
* is on the shuttle's route.
|
||||
*
|
||||
* @param shuttle
|
||||
* @param degreeDelta
|
||||
* @returns
|
||||
*/
|
||||
public async getArrivedStopIfExists(
|
||||
shuttle: IShuttle,
|
||||
returnNextStopOnly: boolean = false,
|
||||
): Promise<IStop | undefined> {
|
||||
const degreeDelta = this.shuttleStopArrivalDegreeDelta;
|
||||
|
||||
const lastStop = await this.getShuttleLastStopArrival(shuttle.id);
|
||||
if (lastStop) {
|
||||
if (lastStop && returnNextStopOnly) {
|
||||
const lastOrderedStop = await this.getOrderedStopByRouteAndStopId(shuttle.routeId, lastStop.stopId);
|
||||
const orderedStopAfter = lastOrderedStop?.nextStop;
|
||||
if (orderedStopAfter) {
|
||||
|
||||
Reference in New Issue
Block a user