mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-19 08:50:29 +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);
|
const arrivedStop = await this.getArrivedStopIfExists(shuttle);
|
||||||
|
|
||||||
if (arrivedStop != undefined) {
|
if (arrivedStop != undefined) {
|
||||||
const lastStopTimestamp = await this.getShuttleLastStopTimestamp(shuttle)
|
const lastStopTimestamp = await this.getShuttleLastStopArrival(shuttle)
|
||||||
if (lastStopTimestamp != undefined) {
|
if (lastStopTimestamp != undefined) {
|
||||||
const now = Date();
|
const now = Date();
|
||||||
const routeId = shuttle.routeId
|
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
|
// 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> {
|
public async getShuttleLastStopArrival(shuttle: IShuttle): Promise<ShuttleStopArrival | undefined> {
|
||||||
throw new Error("Method not implemented.");
|
// 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> {
|
public async addOrUpdateStop(stop: IStop): Promise<void> {
|
||||||
const key = this.createStopKey(stop.id);
|
const key = this.createStopKey(stop.id);
|
||||||
|
|||||||
Reference in New Issue
Block a user