Skip to content

Commit

Permalink
fix: route times
Browse files Browse the repository at this point in the history
  • Loading branch information
NoamGaash committed Oct 12, 2023
1 parent ddd3633 commit 622ea0b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/api/gtfsService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ export async function getRoutesAsync(
const gtfsRoutes = await GTFS_API.gtfsRoutesListGet({
routeShortName: lineNumber,
operatorRefs: operatorId,
dateFrom: fromTimestamp.toDate(),
dateTo: toTimestamp.toDate(),
dateFrom: fromTimestamp.startOf('day').toDate(),
dateTo: moment.min(toTimestamp.endOf('day'), moment()).toDate(),
limit: 100,
})
const routes = Object.values(
Expand Down
2 changes: 1 addition & 1 deletion src/api/useVehicleLocations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ export default function useVehicleLocations({
unmounts.forEach((unmount) => unmount())
setIsLoading([])
}
}, [from, to])
}, [from, to, lineRef, split])
return {
locations,
isLoading: isLoading.some((loading) => loading),
Expand Down
7 changes: 1 addition & 6 deletions src/pages/SingleLineMapPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,7 @@ const SingleLineMapPage = () => {
if (!operatorId || !lineNumber) {
return
}
getRoutesAsync(
moment(timestamp - 24 * 60 * 60 * 1000),
moment(timestamp),
operatorId,
lineNumber,
).then((routes) =>
getRoutesAsync(moment(timestamp), moment(timestamp), operatorId, lineNumber).then((routes) =>
setSearch((current) =>
search.lineNumber === lineNumber ? { ...current, routes: routes } : current,
),
Expand Down

0 comments on commit 622ea0b

Please sign in to comment.