Skip to content

Commit

Permalink
fix: interrupção do preditor qnd pesquisa por novos pontos
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel0109 committed Mar 17, 2023
1 parent 4515884 commit 2c9b1cd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/components/Header/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { RoutesContext } from '../../hooks/getRoutes'
import { NameContext } from '../../hooks/getName'
import { api } from '../../services/api'
import { MovingMarkerContext } from '../../hooks/getMovingMarkers'
import { GPSContext } from '../../hooks/getGPS'

export function Header(props) {
let navigate = useNavigate()
Expand All @@ -26,6 +27,7 @@ export function Header(props) {
const { setRoutes, setPlataforms, setStopId} = useContext(RoutesContext)
const { setResults, results, similarNames } = useContext(NameContext)
const {setTracked, setInnerCircle} = useContext(MovingMarkerContext)
const {stopFetching} = useContext(GPSContext)
function clearInfo() {
setTrip('')
setCode("")
Expand All @@ -39,6 +41,7 @@ export function Header(props) {
setStopId()
setSppo()
setInnerCircle([])
stopFetching()

}

Expand All @@ -48,6 +51,7 @@ export function Header(props) {

const searchNewCode = event => {
setNewCode(event.target.value)
stopFetching()
setTrip('')
setValue()
setPlataforms([])
Expand Down
4 changes: 2 additions & 2 deletions src/hooks/getMovingMarkers.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ export function MovingMarkerProvider({ children }) {
let filteredGPS = trackedBuses.filter(item => {
return routes.some(filterItem => {
if (stopInfo) {
return item.linha === filterItem.trip_id.trip_short_name && item.hora[0] < 5 && item.sentido === stopInfo.direction_id && item.chegada > -1
return item.linha === filterItem.trip_id.trip_short_name && item.hora[0] < 5 && item.sentido === stopInfo.direction_id && item.distancia > -0.100
} else {
return (item.linha === filterItem.trip_id.trip_short_name && item.hora[0] < 5 && item.chegada > -1)
return (item.linha === filterItem.trip_id.trip_short_name && item.hora[0] < 5 && item.distancia > -0.100)
}
});
});
Expand Down

0 comments on commit 2c9b1cd

Please sign in to comment.