From eeadfa62cb932df6c84cde352e5aaded8e7df96e Mon Sep 17 00:00:00 2001 From: Brendan Chen Date: Wed, 8 Jan 2025 16:39:11 -0800 Subject: [PATCH] fix id in conditional and return milleseconds for eta --- src/repositories/ApiBasedRepository.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/repositories/ApiBasedRepository.ts b/src/repositories/ApiBasedRepository.ts index e1ca9d1..5eb963e 100644 --- a/src/repositories/ApiBasedRepository.ts +++ b/src/repositories/ApiBasedRepository.ts @@ -107,9 +107,9 @@ export class ApiBasedRepository implements GetterRepository { }); const json = await response.json(); - if (json.ETAs && json.ETAs[systemId]) { + if (json.ETAs && json.ETAs[stop.id]) { // Continue with the parsing - json.ETAs[systemId].forEach((jsonEta: any) => { + json.ETAs[stop.id].forEach((jsonEta: any) => { // Update cache if (!this.cache.etasForStopId) { this.cache.etasForStopId = {}; @@ -134,6 +134,7 @@ export class ApiBasedRepository implements GetterRepository { secondsRemaining: jsonEta.secondsSpent, shuttleId: `${shuttleId}`, stopId: stop.id, + millisecondsSinceEpoch: Date.now(), }; this.cache.etasForStopId[stop.id].push(eta);