mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-16 23:40:32 +00:00
Add necessary call to updateShuttleLastTimeArrival
This commit is contained in:
@@ -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<ShuttleStopArrival> {
|
||||
throw new Error("Method not implemented.");
|
||||
public async getShuttleLastStopArrival(shuttle: IShuttle): Promise<ShuttleStopArrival | undefined> {
|
||||
// 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<void> {
|
||||
const key = this.createStopKey(stop.id);
|
||||
|
||||
Reference in New Issue
Block a user