Skip to content

Commit 712aa92

Browse files
authored
Merge pull request #3371 from appirio-tech/hotfix/skills-no-filter
[PROD] [HOTFIX] support Skills questions showing all skills without filtering by categories
2 parents 7a06d3f + a36584c commit 712aa92

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/projects/detail/components/SkillsQuestion/SkillsQuestion.jsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,13 @@ class SkillsQuestion extends React.Component {
112112
const { options, customOptionValue } = this.state
113113

114114
const selectedCategories = _.get(currentProjectData, categoriesField, [])
115-
const mappedCategories = _.map(selectedCategories, (category) => categoriesMapping[category] ? categoriesMapping[category].toLowerCase() : null)
116-
const availableOptions = options
117-
.filter(option => _.intersection((option.categories || []).map(c => c.toLowerCase()), mappedCategories).length > 0)
118-
.map(
119-
option => _.pick(option, ['id', 'name'])
120-
)
115+
const mappedCategories = categoriesMapping && _.map(selectedCategories, (category) => categoriesMapping[category] ? categoriesMapping[category].toLowerCase() : null)
116+
117+
// if have a mapping for categories, then filter options, otherwise use all options
118+
const availableOptions = (categoriesMapping
119+
? options.filter(option => _.intersection((option.categories || []).map(c => c.toLowerCase()), mappedCategories).length > 0)
120+
: options
121+
).map(option => _.pick(option, ['id', 'name']))
121122

122123
let currentValues = getValue() || []
123124
// remove from currentValues not available options but still keep created custom options without id

0 commit comments

Comments
 (0)