Skip to content

Commit

Permalink
fix: service_id comparando da forma certa para frequencies
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel0109 committed Jun 13, 2023
1 parent 753626a commit 70c94a4
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/hooks/getMovingMarkers.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ export function MovingMarkerProvider({ children }) {
}, [code])



useEffect(() => {
if (realtime && routes) {
const currentTime = new Date().getTime();
Expand Down Expand Up @@ -159,7 +158,7 @@ export function MovingMarkerProvider({ children }) {
const tripsList = routes
.filter((i) => i.stop_sequence === 0)
.map((i) => i.trip_id.trip_short_name)
getallFrequencies(`/frequencies/?trip_short_name=${tripsList}&service_id=${serviceId}&stop_id=${stopId}`)
getallFrequencies(`/frequencies/?trip_short_name=${tripsList}&service_id=${serviceId}`)
} else {
getallFrequencies(`/frequencies/?&stop_id=${stopId}&service_id=${serviceId}&show_all=true`)
}
Expand All @@ -171,7 +170,7 @@ export function MovingMarkerProvider({ children }) {
const matched = frequencies.filter((obj2) => {
return (
obj1.trip_id.trip_short_name === obj2.trip_id.trip_short_name &&
serviceId === obj2.trip_id.service_id
serviceId.includes(obj2.trip_id.service_id)
);
});
const combinedHeadways = matched.reduce((headwaysAcc, freq) => {
Expand All @@ -184,7 +183,6 @@ export function MovingMarkerProvider({ children }) {
if (combinedHeadways.length > 0) {
const closestStartTime = combinedHeadways.find((headway) => {
if (locationType === 1) {

return headway.start_time > currentTime;
} else {
return headway.end_time > currentTime;
Expand Down Expand Up @@ -251,7 +249,6 @@ export function MovingMarkerProvider({ children }) {
if (a.start_time > b.start_time) return 1;
return 0;
});

return headways;
}

Expand Down

0 comments on commit 70c94a4

Please sign in to comment.