mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-17 16:00:32 +00:00
fix id in conditional and return milleseconds for eta
This commit is contained in:
@@ -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);
|
||||||
|
|||||||
Reference in New Issue
Block a user