From f7bfa86fc9e54c167a947107efad44c88dfa99ec Mon Sep 17 00:00:00 2001 From: maxceem Date: Wed, 17 Jul 2019 20:42:34 +0800 Subject: [PATCH 1/2] [HOTFIX] [PROD] Filter skills ignore case of categories (#3186) * 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 --- .../detail/components/SkillsQuestion/SkillsQuestion.jsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/projects/detail/components/SkillsQuestion/SkillsQuestion.jsx b/src/projects/detail/components/SkillsQuestion/SkillsQuestion.jsx index e0f5b6321..ada9585e5 100644 --- a/src/projects/detail/components/SkillsQuestion/SkillsQuestion.jsx +++ b/src/projects/detail/components/SkillsQuestion/SkillsQuestion.jsx @@ -60,8 +60,8 @@ class SkillsQuestion extends React.Component { const mappedSelectedCategories = _.map(selectedCategories, (category) => categoriesMapping[category] ? categoriesMapping[category].toLowerCase() : null) const currentValues = getValue() || [] - const prevAvailableOptions = options.filter(option => _.intersection(option.categories, mappedPrevSelectedCategories).length > 0) - const nextAvailableOptions = options.filter(option => _.intersection(option.categories, mappedSelectedCategories).length > 0) + const prevAvailableOptions = options.filter(option => _.intersection((option.categories || []).map(c => c.toLowerCase()), mappedPrevSelectedCategories).length > 0) + const nextAvailableOptions = options.filter(option => _.intersection((option.categories || []).map(c => c.toLowerCase()), mappedSelectedCategories).length > 0) const prevValues = currentValues.filter(skill => _.some(prevAvailableOptions, skill)) const nextValues = currentValues.filter(skill => _.some(nextAvailableOptions, skill)) @@ -114,7 +114,7 @@ class SkillsQuestion extends React.Component { const selectedCategories = _.get(currentProjectData, categoriesField, []) const mappedCategories = _.map(selectedCategories, (category) => categoriesMapping[category] ? categoriesMapping[category].toLowerCase() : null) const availableOptions = options - .filter(option => _.intersection(option.categories, mappedCategories).length > 0) + .filter(option => _.intersection((option.categories || []).map(c => c.toLowerCase()), mappedCategories).length > 0) .map( option => _.pick(option, ['id', 'name']) ) From aaef15116a777e99bc5fa7dedbbb0eb64474b033 Mon Sep 17 00:00:00 2001 From: Vikas Agarwal Date: Thu, 18 Jul 2019 13:02:27 +0530 Subject: [PATCH 2/2] =?UTF-8?q?Github=20issue#3189,=20Unable=20to=20activa?= =?UTF-8?q?te=20a=20phase=20without=20explicitly=20setting=20start=20date?= =?UTF-8?q?=20to=20today's=20date=20=E2=80=94=20Calculate=20the=20end=20da?= =?UTF-8?q?te=20as=20well=20when=20activating=20the=20phase?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/projects/actions/project.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/projects/actions/project.js b/src/projects/actions/project.js index 8d04333df..ffa43fe4d 100644 --- a/src/projects/actions/project.js +++ b/src/projects/actions/project.js @@ -342,7 +342,9 @@ export function updatePhase(projectId, phaseId, updatedProps, phaseIndex) { const startDateChanged = updatedProps.startDate ? updatedProps.startDate.diff(phaseStartDate) : null const phaseActivated = phaseStatusChanged && updatedProps.status === PHASE_STATUS_ACTIVE if (phaseActivated) { - updatedProps.startDate = moment().hours(0).minutes(0).seconds(0).milliseconds(0) + const duration = updatedProps.duration ? updatedProps.duration : phase.duration + updatedProps.startDate = moment().utc().hours(0).minutes(0).seconds(0).milliseconds(0).toISOString() + updatedProps.endDate = moment(updatedProps.startDate).add(duration - 1, 'days').toISOString() } return dispatch({