Skip to content

Commit

Permalink
Merge branch 'dev' into nearby-view-optional-long-name-rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
amy-corson-ibigroup authored Jun 25, 2024
2 parents d4a0e3d + 3eea5c0 commit e00e7ab
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/actions/apiV2.js
Original file line number Diff line number Diff line change
Expand Up @@ -939,7 +939,8 @@ export function routingQuery(searchId = null, updateSearchInReducer) {
modes,
numItineraries,
routingType,
time
time,
unpreferred
} = currentQuery
const arriveBy = departArrive === 'ARRIVE'

Expand Down Expand Up @@ -997,6 +998,7 @@ export function routingQuery(searchId = null, updateSearchInReducer) {
numItineraries: numItineraries || config?.modes?.numItineraries || 7,
time,
to: currentQuery.to,
unpreferred,
// TODO: Does this break everything?
...currentQuery
}
Expand Down
13 changes: 13 additions & 0 deletions lib/actions/field-trip.js
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,9 @@ export function saveRequestTripItineraries(request, outbound, intl) {
function prepareQueryParams(request, outbound) {
return async function (dispatch, getState) {
const { config } = getState().otp
const { modules, transitOperators } = config
const fieldTripOptions = modules?.find((m) => m.id === 'ft')?.options

const queryParams = {
date: format(parseDate(request.travelDate), OTP_API_DATE_FORMAT)
}
Expand All @@ -520,6 +523,16 @@ function prepareQueryParams(request, outbound) {
OTP_API_TIME_FORMAT
)
}
// Generate banned list from clear list
if (fieldTripOptions?.allowedAgencies) {
const bannedAgencies = transitOperators
.map((to) => to.agencyId)
.filter((to) => !fieldTripOptions.allowedAgencies.includes(to))

queryParams.unpreferred = {
agencies: bannedAgencies
}
}
const locations = await planParamsToQueryAsync(locationsToGeocode, config)
return dispatch(setQueryParam({ ...locations, ...queryParams }))
}
Expand Down

0 comments on commit e00e7ab

Please sign in to comment.