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({ 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']) )