fix id in conditional and return milleseconds for eta

This commit is contained in:
2025-01-08 16:39:11 -08:00
parent 55501a0d92
commit eeadfa62cb

View File

@@ -107,9 +107,9 @@ export class ApiBasedRepository implements GetterRepository {
}); });
const json = await response.json(); const json = await response.json();
if (json.ETAs && json.ETAs[systemId]) { if (json.ETAs && json.ETAs[stop.id]) {
// Continue with the parsing // Continue with the parsing
json.ETAs[systemId].forEach((jsonEta: any) => { json.ETAs[stop.id].forEach((jsonEta: any) => {
// Update cache // Update cache
if (!this.cache.etasForStopId) { if (!this.cache.etasForStopId) {
this.cache.etasForStopId = {}; this.cache.etasForStopId = {};
@@ -134,6 +134,7 @@ export class ApiBasedRepository implements GetterRepository {
secondsRemaining: jsonEta.secondsSpent, secondsRemaining: jsonEta.secondsSpent,
shuttleId: `${shuttleId}`, shuttleId: `${shuttleId}`,
stopId: stop.id, stopId: stop.id,
millisecondsSinceEpoch: Date.now(),
}; };
this.cache.etasForStopId[stop.id].push(eta); this.cache.etasForStopId[stop.id].push(eta);