Skip to content

Commit 84e4680

Browse files
maxceemvikasrohit
authored andcommitted
[HOTFIX] [DEV] Filter skills ignore case of categories (#3187)
* fix: filter skills inside SkillsQuestion component ignoring case of skill categories which come from skill API * improve fix to make sure it's not broken if data from skills API is not complete
1 parent 5b7cb17 commit 84e4680

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ class SkillsQuestion extends React.Component {
6060
const mappedSelectedCategories = _.map(selectedCategories, (category) => categoriesMapping[category] ? categoriesMapping[category].toLowerCase() : null)
6161

6262
const currentValues = getValue() || []
63-
const prevAvailableOptions = options.filter(option => _.intersection(option.categories, mappedPrevSelectedCategories).length > 0)
64-
const nextAvailableOptions = options.filter(option => _.intersection(option.categories, mappedSelectedCategories).length > 0)
63+
const prevAvailableOptions = options.filter(option => _.intersection((option.categories || []).map(c => c.toLowerCase()), mappedPrevSelectedCategories).length > 0)
64+
const nextAvailableOptions = options.filter(option => _.intersection((option.categories || []).map(c => c.toLowerCase()), mappedSelectedCategories).length > 0)
6565
const prevValues = currentValues.filter(skill => _.some(prevAvailableOptions, skill))
6666
const nextValues = currentValues.filter(skill => _.some(nextAvailableOptions, skill))
6767

@@ -114,7 +114,7 @@ class SkillsQuestion extends React.Component {
114114
const selectedCategories = _.get(currentProjectData, categoriesField, [])
115115
const mappedCategories = _.map(selectedCategories, (category) => categoriesMapping[category] ? categoriesMapping[category].toLowerCase() : null)
116116
const availableOptions = options
117-
.filter(option => _.intersection(option.categories, mappedCategories).length > 0)
117+
.filter(option => _.intersection((option.categories || []).map(c => c.toLowerCase()), mappedCategories).length > 0)
118118
.map(
119119
option => _.pick(option, ['id', 'name'])
120120
)

0 commit comments

Comments
 (0)