diff --git a/CHANGELOG.md b/CHANGELOG.md index 76a88350..a6c97b2e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -63,6 +63,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Refactor networks data state to support place comparisons [#699](https://github.com/azavea/echo-locator/pull/699) - Refactor user authentication APIs [#718](https://github.com/azavea/echo-locator/pull/718) - Implement units design changes [#776](https://github.com/azavea/echo-locator/pull/776) +- Allow un-routable neighborhoods to be recommended [#806](https://github.com/azavea/echo-locator/pull/806) ### Fixed diff --git a/src/frontend/src/reducers/neighborhoods/selectors/neighborhoodsSortedWithRoutes.ts b/src/frontend/src/reducers/neighborhoods/selectors/neighborhoodsSortedWithRoutes.ts index 81415a62..71bffc2d 100644 --- a/src/frontend/src/reducers/neighborhoods/selectors/neighborhoodsSortedWithRoutes.ts +++ b/src/frontend/src/reducers/neighborhoods/selectors/neighborhoodsSortedWithRoutes.ts @@ -10,7 +10,6 @@ import pullAt from "lodash/pullAt"; import { BOOST_DOWNTOWN_RESULT_PLACE, DOWNTOWN_AREAS, - MAX_TRAVEL_TIME, RESULTS_WITH_DOWNTOWN, } from "../../../constants"; import { createSelector } from "@reduxjs/toolkit"; @@ -91,13 +90,12 @@ export default createSelector( n ); - const isRoutable = - (useTransit && segments.length) || !useTransit; - if (isRoutable && time < MAX_TRAVEL_TIME) { + // A neighborhood is not technically "routable" if: + // (useTransit and !segments.length) OR time >= MAX_TRAVEL_TIME + // However, we don't want to exclude non-routable neighborhoods + // from recommendations entirely as they may be a valid options for someone. + // For this reason, add all neighborhoods to recommended list by default. recommendedNeighborhoodsList.push(result); - } else { - tooFarNeighborhoodsList.push(result); - } }); const rankedRecommendedNeighborhoods = orderBy( recommendedNeighborhoodsList, diff --git a/src/frontend/src/reducers/neighborhoods/utils/createNeighborhoodWeightedScore.ts b/src/frontend/src/reducers/neighborhoods/utils/createNeighborhoodWeightedScore.ts index 8afd8773..88899a6d 100644 --- a/src/frontend/src/reducers/neighborhoods/utils/createNeighborhoodWeightedScore.ts +++ b/src/frontend/src/reducers/neighborhoods/utils/createNeighborhoodWeightedScore.ts @@ -46,7 +46,7 @@ export const createNeighborhoodWeightedScore = ( // Routable neighborhoods outside the max travel time window filtered into separate list. // Smaller travel time is better; larger timeWeight is better (reverse range). const timeWeight = - time < MAX_TRAVEL_TIME ? scale(time, 0, MAX_TRAVEL_TIME, 1, 0) : 1; + time < MAX_TRAVEL_TIME ? scale(time, 0, MAX_TRAVEL_TIME, 1, 0) : 0; // Weight schools either by percentile binned into quarters if given max importance, // or otherwise weight by quintile. let educationWeight;