mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-17 07:50:31 +00:00
Modify getShuttleLastStopArrival to use shuttle ID
This commit is contained in:
@@ -440,7 +440,7 @@ export class RedisShuttleRepository extends EventEmitter implements ShuttleGette
|
||||
) {
|
||||
const oneWeekAgo = new Date(referenceCurrentTime.getTime() - (60 * 60 * 24 * 7 * 1000))
|
||||
|
||||
const lastStopArrival = await this.getShuttleLastStopArrival(shuttle)
|
||||
const lastStopArrival = await this.getShuttleLastStopArrival(shuttle.id)
|
||||
if (lastStopArrival == undefined) return;
|
||||
|
||||
const lastOrderedStop = await this.getOrderedStopByRouteAndStopId(shuttle.routeId, lastStopArrival.stopId);
|
||||
@@ -476,7 +476,7 @@ export class RedisShuttleRepository extends EventEmitter implements ShuttleGette
|
||||
const arrivedStop = await this.getArrivedStopIfExists(shuttle);
|
||||
|
||||
if (arrivedStop != undefined) {
|
||||
const lastStopTimestamp = await this.getShuttleLastStopArrival(shuttle)
|
||||
const lastStopTimestamp = await this.getShuttleLastStopArrival(shuttle.id)
|
||||
if (lastStopTimestamp != undefined) {
|
||||
const routeId = shuttle.routeId;
|
||||
const fromStopId = lastStopTimestamp.stopId;
|
||||
@@ -612,8 +612,8 @@ export class RedisShuttleRepository extends EventEmitter implements ShuttleGette
|
||||
return undefined;
|
||||
}
|
||||
|
||||
public async getShuttleLastStopArrival(shuttle: IShuttle): Promise<ShuttleStopArrival | undefined> {
|
||||
const key = this.createShuttleLastStopKey(shuttle.id);
|
||||
public async getShuttleLastStopArrival(shuttleId: string): Promise<ShuttleStopArrival | undefined> {
|
||||
const key = this.createShuttleLastStopKey(shuttleId);
|
||||
const data = await this.redisClient.hGetAll(key);
|
||||
|
||||
if (Object.keys(data).length === 0) {
|
||||
|
||||
Reference in New Issue
Block a user