Skip to content

Commit 92d9383

Browse files
committed
Fix unroutable timeWeight assignment
If a neighborhood is unroutable we don't create an scaled accessibility weight but instead define a default weight value, 1. This is the "best" weight, but because there is no route information to evaluate these neighborhoods were previously being binned in the "too far" list and the accessibility sorting doesn't matter. Now that unroutable neighborhoods can be recommended, the weight actually holds value in the overall score. Instead we should set these neighborhoods to the worst weighted value, 0, so unroutable neighborhoods will be sorted to the bottom of the recommendation list, as needed.
1 parent 4ce4535 commit 92d9383

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/frontend/src/reducers/neighborhoods/utils/createNeighborhoodWeightedScore.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export const createNeighborhoodWeightedScore = (
4646
// Routable neighborhoods outside the max travel time window filtered into separate list.
4747
// Smaller travel time is better; larger timeWeight is better (reverse range).
4848
const timeWeight =
49-
time < MAX_TRAVEL_TIME ? scale(time, 0, MAX_TRAVEL_TIME, 1, 0) : 1;
49+
time < MAX_TRAVEL_TIME ? scale(time, 0, MAX_TRAVEL_TIME, 1, 0) : 0;
5050
// Weight schools either by percentile binned into quarters if given max importance,
5151
// or otherwise weight by quintile.
5252
let educationWeight;

0 commit comments

Comments
 (0)