diff --git a/client/components/FacultyMonitoringView/FacultyTrackingView/QuestionPicker.js b/client/components/FacultyMonitoringView/FacultyTrackingView/QuestionPicker.js index 682acf9b..9d48cf7a 100644 --- a/client/components/FacultyMonitoringView/FacultyTrackingView/QuestionPicker.js +++ b/client/components/FacultyMonitoringView/FacultyTrackingView/QuestionPicker.js @@ -9,7 +9,8 @@ const QuestionPicker = ({ index, label, questionsList, form }) => { const { t } = useTranslation() const dispatch = useDispatch() const lang = useSelector(state => state.language) - const allSelectedQuestions = useSelector(({ form }) => form.data.selectedQuestionIds || []) + const answers = useSelector(({ form }) => form.data) + const allSelectedQuestions = answers.selectedQuestionIds || [] const [sectionQuestions, setSectionQuestions] = useState([]) useEffect(() => { @@ -31,9 +32,25 @@ const QuestionPicker = ({ index, label, questionsList, form }) => { updateAllSelectedQuestions(newQuestion) } + const isFilled = question => { + const questionKeys = Object.keys(answers).filter( + key => key.startsWith(`${question.id}_`) && !key.includes('degree_radio') && !key.includes('modal'), + ) + if (questionKeys.some(key => answers[key] && answers[key].length > 0)) { + return ( + <> + {`${question.index}. ${question.label[lang]}-`} + {`(${t('common:filled')})`} + + ) + } + + return {`${question.index}. ${question.label[lang]}`} + } + const dropdownOptions = questionsList.map(question => ({ key: question.id, - text: `${question.index}. ${question.label[lang]}`, + text: isFilled(question), value: question.id, })) diff --git a/client/util/locales/en.js b/client/util/locales/en.js index b13ff0da..6165829b 100644 --- a/client/util/locales/en.js +++ b/client/util/locales/en.js @@ -58,6 +58,7 @@ export default { cancel: 'Cancel', edit: 'Edit', delete: 'Delete', + filled: 'filled', yearlyAssessment: 'Annual follow-up', evaluation: 'Review', diff --git a/client/util/locales/fi.js b/client/util/locales/fi.js index a0515a51..64e0b1d3 100644 --- a/client/util/locales/fi.js +++ b/client/util/locales/fi.js @@ -65,6 +65,7 @@ export default { cancel: 'Peruuta', edit: 'Muokkaa', delete: 'Poista', + filled: 'täytetty', modifyLights: 'Muokkaa valoja', diff --git a/client/util/locales/se.js b/client/util/locales/se.js index b2bac0e5..2b0722a7 100644 --- a/client/util/locales/se.js +++ b/client/util/locales/se.js @@ -62,6 +62,7 @@ export default { cancel: 'Avbryt', edit: 'Redigera', delete: 'Ta bort', + filled: 'ifylld', yearlyAssessment: 'Årlig uppföljning', evaluation: 'Översynen',