Skip to content

Commit

Permalink
Fix reverse route for GMB
Browse files Browse the repository at this point in the history
  • Loading branch information
chunlaw committed Jan 5, 2024
1 parent db6656d commit 0ac659d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/components/route-eta/ReverseButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const ReverseButton = ({ routeId }: { routeId: string }) => {
db: { routeList, holidays, stopList, serviceDayMap },
vibrateDuration,
} = useContext(AppContext);
const { route, stops, co } = routeList[routeId];
const { route, stops, co, gtfsId } = routeList[routeId];
const navigate = useNavigate();

const isTodayHoliday = useMemo(
Expand All @@ -28,7 +28,10 @@ const ReverseButton = ({ routeId }: { routeId: string }) => {
.reduce<Array<[string, RouteListEntry]>>(
(acc, [key, _routeListEntry]) => {
if (key === routeId) return acc;
const { co: _co, route: _route } = _routeListEntry;
const { co: _co, route: _route, gtfsId: _gtfsId } = _routeListEntry;
if (co[0] === "gmb" && gtfsId && gtfsId !== _gtfsId) {
return acc;
}
if (
_route === route &&
JSON.stringify(co) === JSON.stringify(_co)
Expand Down Expand Up @@ -78,6 +81,7 @@ const ReverseButton = ({ routeId }: { routeId: string }) => {
[
route,
co,
gtfsId,
routeList,
stopList,
isTodayHoliday,
Expand Down

0 comments on commit 0ac659d

Please sign in to comment.