From 63ed267ded13e3742098186761d799a6a9736c9b Mon Sep 17 00:00:00 2001 From: Brendan Chen Date: Mon, 10 Nov 2025 14:54:48 -0800 Subject: [PATCH] Add necessary call to updateShuttleLastTimeArrival --- .../shuttle/RedisShuttleRepository.ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/repositories/shuttle/RedisShuttleRepository.ts b/src/repositories/shuttle/RedisShuttleRepository.ts index d6e03d6..5eae7cc 100644 --- a/src/repositories/shuttle/RedisShuttleRepository.ts +++ b/src/repositories/shuttle/RedisShuttleRepository.ts @@ -418,7 +418,7 @@ export class RedisShuttleRepository extends EventEmitter implements ShuttleGette const arrivedStop = await this.getArrivedStopIfExists(shuttle); if (arrivedStop != undefined) { - const lastStopTimestamp = await this.getShuttleLastStopTimestamp(shuttle) + const lastStopTimestamp = await this.getShuttleLastStopArrival(shuttle) if (lastStopTimestamp != undefined) { const now = Date(); const routeId = shuttle.routeId @@ -430,7 +430,10 @@ export class RedisShuttleRepository extends EventEmitter implements ShuttleGette // Value: seconds it took to get from lastStopTimestamp.stopId to arrivedStop.id } - // TODO: Update the "last stop timestamp" + await this.updateShuttleLastStopArrival(shuttle, { + stopId: arrivedStop.id, + timestamp: new Date(), + }) } } @@ -446,10 +449,15 @@ export class RedisShuttleRepository extends EventEmitter implements ShuttleGette } } - public async getShuttleLastStopTimestamp(shuttle: IShuttle): Promise { - throw new Error("Method not implemented."); + public async getShuttleLastStopArrival(shuttle: IShuttle): Promise { + // Get the *time* of the most recent time series entry for the key + throw Error("not implemented"); } + private async updateShuttleLastStopArrival(shuttle: IShuttle, lastStopArrival: ShuttleStopArrival) { + // Key: shuttleId:stopId: + // Value: just a marker (no numerical value) + } public async addOrUpdateStop(stop: IStop): Promise { const key = this.createStopKey(stop.id);