For data from last week and previous day, look back instead of looking forward

This commit is contained in:
2025-11-14 10:40:37 -08:00
parent 397eb2b588
commit f8e7670b3f
3 changed files with 17 additions and 16 deletions

View File

@@ -133,19 +133,19 @@ export class RedisSelfUpdatingETARepository extends BaseRedisETARepository imple
const oneDayAgo = new Date(referenceCurrentTime.getTime() - (60 * 60 * 24 * 1000));
const twoHoursAgo = new Date(referenceCurrentTime.getTime() - (120 * 60 * 1000));
const twoHoursMs = 120 * 60 * 1000;
const twoHoursInMs = 120 * 60 * 1000;
const travelTimeSeconds = await this.getAverageTravelTimeSecondsWithFallbacks({
routeId: shuttle.routeId,
fromStopId: currentStop.stopId,
toStopId: nextStop.stopId,
}, [
{
from: oneWeekAgo,
to: new Date(oneWeekAgo.getTime() + (twoHoursMs))
from: new Date(oneWeekAgo.getTime() - (twoHoursInMs)),
to: oneWeekAgo,
},
{
from: oneDayAgo,
to: new Date(oneDayAgo.getTime() + (twoHoursMs))
from: new Date(oneDayAgo.getTime() - (twoHoursInMs)),
to: oneDayAgo,
},
{
from: twoHoursAgo,