Skip to content

Commit 35b4dbd

Browse files
committed
fix(editor fields): fix wheelchairBoarding for stops and routes
1 parent e2722a8 commit 35b4dbd

File tree

3 files changed

+45
-27
lines changed

3 files changed

+45
-27
lines changed

gtfs.yml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,11 +203,11 @@
203203
required: false
204204
inputType: DROPDOWN
205205
options:
206-
- value: '0'
206+
- value: 'UNKNOWN'
207207
text: No information (0)
208-
- value: '1'
208+
- value: 'AVAILABLE'
209209
text: At least some vehicles (1)
210-
- value: '2'
210+
- value: 'UNAVAILABLE'
211211
text: Not possible (2)
212212
columnWidth: 12
213213
helpContent: "The wheelchair_boarding field identifies whether wheelchair boardings are possible from the specified stop or station. The field can have the following values:"
@@ -314,6 +314,19 @@
314314
text: Black
315315
columnWidth: 6
316316
helpContent: The route_text_color field can be used to specify a legible color to use for text drawn against a background of route_color. The color must be provided as a six-character hexadecimal number, for example, FFD700. If no color is specified, the default text color is black (000000).
317+
- name: wheelchair_boarding
318+
required: false
319+
displayName: Is route wheelchair accessible?
320+
inputType: DROPDOWN
321+
columnWidth: 12
322+
helpContent: Indicates whether vehicles that operate on this route are wheelchair accessible.
323+
options:
324+
- value: 'UNKNOWN'
325+
text: No information (0)
326+
- value: 'AVAILABLE'
327+
text: Yes (1)
328+
- value: 'UNAVAILABLE'
329+
text: No (2)
317330
- name: route_branding_url
318331
required: false
319332
displayName: Route branding URL

lib/editor/actions/route.js

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import { secureFetch } from '../../common/actions'
2-
import { updateEditSetting, setActiveGtfsEntity } from './active'
1+
import {secureFetch} from '../../common/actions'
2+
import {isNew, routeFromGtfs} from '../util/objects'
3+
import {updateEditSetting, setActiveGtfsEntity} from './active'
34

45
export function savingRoute (feedId, route) {
56
return {
@@ -19,27 +20,9 @@ export function receiveRoute (feedId, route) {
1920

2021
export function saveRoute (feedId, route) {
2122
return function (dispatch, getState) {
22-
const method = route.id !== 'new' ? 'put' : 'post'
23-
const url = route.id !== 'new'
24-
? `/api/editor/secure/route/${route.id}?feedId=${feedId}`
25-
: `/api/editor/secure/route?feedId=${feedId}`
26-
const data = {
27-
gtfsRouteId: route.route_id,
28-
agencyId: route.agency_id,
29-
feedId: route.feedId,
30-
routeBrandingUrl: route.route_branding_url,
31-
publiclyVisible: route.publiclyVisible,
32-
status: route.status,
33-
34-
routeShortName: route.route_short_name,
35-
routeLongName: route.route_long_name,
36-
routeDesc: route.route_desc,
37-
gtfsRouteType: route.route_type,
38-
routeUrl: route.route_url,
39-
routeColor: route.route_color,
40-
routeTextColor: route.route_text_color,
41-
id: route.id === 'new' ? null : route.id
42-
}
23+
const method = !isNew(route) ? 'put' : 'post'
24+
const url = `/api/editor/secure/route${!isNew(route) ? `/${route.id}` : ''}?feedId=${feedId}`
25+
const data = routeFromGtfs(route)
4326
return dispatch(secureFetch(url, method, data))
4427
.then(res => res.json())
4528
.then(r => {

lib/editor/util/objects.js

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,29 @@ export function routeToGtfs (route) {
7373
route_url: route.routeUrl,
7474
route_color: route.routeColor,
7575
route_text_color: route.routeTextColor,
76-
route_id: route.gtfsRouteId
76+
route_id: route.gtfsRouteId,
77+
wheelchair_boarding: route.wheelchairBoarding
78+
}
79+
}
80+
81+
export function routeFromGtfs (route) {
82+
return {
83+
gtfsRouteId: route.route_id,
84+
agencyId: route.agency_id,
85+
feedId: route.feedId,
86+
routeBrandingUrl: route.route_branding_url,
87+
publiclyVisible: route.publiclyVisible,
88+
status: route.status,
89+
90+
routeShortName: route.route_short_name,
91+
routeLongName: route.route_long_name,
92+
routeDesc: route.route_desc,
93+
gtfsRouteType: route.route_type,
94+
routeUrl: route.route_url,
95+
routeColor: route.route_color,
96+
routeTextColor: route.route_text_color,
97+
wheelchairBoarding: route.wheelchair_boarding,
98+
id: isNew(route) ? null : route.id
7799
}
78100
}
79101

0 commit comments

Comments
 (0)