-
Notifications
You must be signed in to change notification settings - Fork 88
Updates to gtfs spec changes - front end UI fields only #668
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
b299745
976b5c7
b1341cf
8a9c383
baaba8b
acd651a
93b1f53
5397f4a
ad6bfe6
6a9e2ed
b30a941
c4cf115
36a759d
79073f7
094efc7
7717c28
f1cb21e
ff05ac7
5d17fbb
c728b3d
212cf37
3b97719
826088d
4039af7
0255029
ae5eaae
cb588be
a95a02c
5696ff1
2eda50c
e692199
f567077
589b6c6
ef69da3
00ea4d4
e180c43
1c5fd78
59d429a
548fb24
c48bb18
cda4f65
be6b088
a5f9c88
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -38,8 +38,14 @@ export function validate ( | |
| const isRequiredButEmpty = required && valueDoesNotExist | ||
| const isOptionalAndEmpty = !required && valueDoesNotExist | ||
| const agencies = getTableById(tableData, 'agency') | ||
| let locationType: ?number = 0 | ||
| let reason = 'Required field must not be empty' | ||
|
|
||
| // entity.locationtype is a string. Convert to number for conditinals later on. | ||
| if (entity && entity.location_type) { | ||
| locationType = parseInt(entity.location_type) | ||
|
||
| } | ||
|
|
||
| // setting as a variable here because of eslint bug | ||
| type CheckPositiveOutput = { | ||
| num?: number, | ||
|
|
@@ -101,9 +107,11 @@ export function validate ( | |
| (indices.length > 1 || | ||
| (indices.length > 0 && entities[indices[0]].id !== entity.id)) | ||
| ) | ||
| console.log(idList.length) | ||
| console.log({entity}) | ||
| if (agencies.length > 1 && entity.agency_id === null) { | ||
| if ( | ||
| name === 'agency_id' && | ||
| idList.length > 1 && | ||
| valueDoesNotExist | ||
| ) { | ||
| reason = 'Identifier is required if more than one agency exists' | ||
| return {field: name, invalid: isRequiredButEmpty, reason} | ||
robertgregg3 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
|
|
@@ -184,30 +192,28 @@ export function validate ( | |
| const isNotLat = value > 90 || value < -90 | ||
| if (isNotLat) { | ||
| reason = 'Field must be valid latitude.' | ||
| return {field: name, invalid: isOptionalAndEmpty || isNotLat, reason} | ||
| return {field: name, invalid: isNotLat, reason} | ||
| } | ||
| if (entity && entity.location_type >= 2) { | ||
| if (!locationType || locationType < 2) { | ||
|
||
| if (isOptionalAndEmpty) { | ||
| reason = '1 Latitude and Longitude are required for your current location type' | ||
| return {field: name, invalid: isOptionalAndEmpty || isNotLat, reason} | ||
| reason = 'Latitude and Longitude are required for your current location type' | ||
| return {field: name, invalid: isOptionalAndEmpty, reason} | ||
| } | ||
| } else { | ||
| return false | ||
| } | ||
| return false | ||
| case 'LONGITUDE': | ||
| const isNotLng = value > 180 || value < -180 | ||
| if (isNotLng) { | ||
robertgregg3 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| reason = 'Field must be valid longitude.' | ||
| return {field: name, invalid: isOptionalAndEmpty || isNotLng, reason} | ||
| } | ||
| if (entity && entity.location_type >= 2) { | ||
| if (!locationType || locationType < 2) { | ||
| if (isOptionalAndEmpty) { | ||
| reason = '1 Latitude and Longitude are required for your current location type' | ||
| reason = 'Latitude and Longitude are required for your current location type' | ||
| return {field: name, invalid: isOptionalAndEmpty || isNotLng, reason} | ||
| } | ||
| } else { | ||
| return false | ||
| } | ||
| return false | ||
| case 'TIME': | ||
| case 'NUMBER': | ||
| const isNotANumber = isNaN(value) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.