Skip to content

Commit f479aca

Browse files
committed
feat(core-utils): add walkTolerance param and restore walkSpeed param for walk-only trips
1 parent 5cab01d commit f479aca

File tree

2 files changed

+62
-1
lines changed

2 files changed

+62
-1
lines changed

packages/core-utils/src/query-params.js

+60
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,64 @@ const queryParams = [
163163
default: true
164164
},
165165

166+
{
167+
/* walkTolerance -- simplified UI for walkReluctance */
168+
name: "walkTolerance",
169+
routingTypes: ["ITINERARY"],
170+
applicable: query =>
171+
query.mode &&
172+
hasTransit(query.mode) && // Only applicable for transit+walk trips
173+
query.mode.indexOf("WALK") !== -1,
174+
default: "2",
175+
selector: "DROPDOWN",
176+
label: "Walk Tolerance",
177+
options: [
178+
{
179+
text: "More walking",
180+
value: 1
181+
},
182+
{
183+
text: "Normal walking",
184+
value: 2
185+
},
186+
{
187+
text: "Less walking",
188+
value: 4
189+
}
190+
],
191+
itineraryRewrite: value => ({
192+
walkReluctance: value
193+
})
194+
},
195+
196+
{
197+
/* walkSpeed -- the user's walking speed in m/s */
198+
name: "walkSpeed",
199+
routingTypes: ["ITINERARY", "PROFILE"],
200+
default: 1.34,
201+
selector: "DROPDOWN",
202+
label: "Walk Speed",
203+
applicable: query =>
204+
!query.otp2 &&
205+
query.mode &&
206+
!hasTransit(query.mode) && // Only applicable for walk-only trips (see walkTolerance for transit+walk)
207+
query.mode.indexOf("WALK") !== -1,
208+
options: [
209+
{
210+
text: "2 MPH",
211+
value: 0.89
212+
},
213+
{
214+
text: "3 MPH",
215+
value: 1.34
216+
},
217+
{
218+
text: "4 MPH",
219+
value: 1.79
220+
}
221+
]
222+
},
223+
166224
{
167225
/* maxWalkDistance - the maximum distance in meters the user will walk to transit. */
168226
name: "maxWalkDistance",
@@ -365,6 +423,7 @@ const queryParams = [
365423
}
366424
]
367425
},
426+
368427
{
369428
name: "walkReluctance",
370429
routingTypes: ["ITINERARY", "PROFILE"],
@@ -382,6 +441,7 @@ const queryParams = [
382441
*/
383442
!!query.otp2 && query.mode && query.mode.indexOf("WALK") !== -1
384443
},
444+
385445
{
386446
/* maxBikeTime -- the maximum time the user will spend biking in minutes */
387447
name: "maxBikeTime",

packages/core-utils/src/query.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ import {
1616

1717
export const defaultParams = [
1818
"wheelchair",
19-
"maxWalkDistance",
2019
"walkReluctance",
20+
"walkTolerance",
21+
"walkSpeed",
2122
"maxWalkTime",
2223
"maxBikeDistance",
2324
"maxBikeTime",

0 commit comments

Comments
 (0)