From 2328eb7947284a2133061fc1e2446cdc5c7b2940 Mon Sep 17 00:00:00 2001 From: tfhuhtal Date: Thu, 3 Oct 2024 19:37:42 +0300 Subject: [PATCH] fixing bug --- .../FacultyTrackingView/Answer.js | 12 +++++------- client/components/ReportPage/index.js | 3 ++- cypress/integration/trackingpage.spec.js | 10 +++++++--- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/client/components/FacultyMonitoringView/FacultyTrackingView/Answer.js b/client/components/FacultyMonitoringView/FacultyTrackingView/Answer.js index b80b6962..de2ac4e8 100644 --- a/client/components/FacultyMonitoringView/FacultyTrackingView/Answer.js +++ b/client/components/FacultyMonitoringView/FacultyTrackingView/Answer.js @@ -21,12 +21,10 @@ const Answer = ({ question, faculty }) => { const facultyAnswers = useMemo(() => { return answers ? answers.find(answer => answer.programme === faculty)?.data || {} : {} }, [answers, faculty]) - const [showAll, setShowAll] = useState(false) const fieldName = `${question.id}_lights_history` const modalName = `${question.id}_modal` const dataFromRedux = useSelector(({ form }) => form.data) const lightsHistory = dataFromRedux[fieldName] || [] - const displayedHistory = showAll ? lightsHistory : lightsHistory.slice(Math.max(lightsHistory.length - 4, 0)) const viewOnly = useSelector(({ form }) => form.viewOnly) const isEditable = !viewOnly @@ -117,10 +115,10 @@ const Answer = ({ question, faculty }) => {
{t(`formView:monitoringTrackingLabel`)}
- {displayedHistory.length > 0 ? ( + {lightsHistory.length > 0 ? ( <> - {displayedHistory.map(entry => ( -
+ {lightsHistory.map((entry, index) => ( +
{t(`common:${entry.color}Faculty`)} @@ -129,11 +127,11 @@ const Answer = ({ question, faculty }) => {
))} - {lightsHistory.length > 4 && ( + {/* lightsHistory.length > 4 && ( - )} + ) */} ) : ( t('formView:noAnswer') diff --git a/client/components/ReportPage/index.js b/client/components/ReportPage/index.js index d6436a26..10442378 100644 --- a/client/components/ReportPage/index.js +++ b/client/components/ReportPage/index.js @@ -75,7 +75,8 @@ export default () => { questionsList = questionsList.filter(q => { if (filters.level === 'doctoral') { return q.id.startsWith('T') - } else if (filters.level !== 'allProgrammes') { + } + if (filters.level !== 'allProgrammes') { return !q.id.startsWith('T') } return true diff --git a/cypress/integration/trackingpage.spec.js b/cypress/integration/trackingpage.spec.js index 0610a860..378f4c43 100644 --- a/cypress/integration/trackingpage.spec.js +++ b/cypress/integration/trackingpage.spec.js @@ -18,7 +18,9 @@ describe('Tracking page tests', () => { cy.get('[data-cy=questions-list-0]').click() - cy.contains('1. Degree programmes include model schedules in curricula that support understanding of the education system, study paths, and course offerings').click() + cy.contains( + '1. Degree programmes include model schedules in curricula that support understanding of the education system, study paths, and course offerings', + ).click() cy.get('[data-cy=send-selection-button]').click() }) @@ -27,7 +29,9 @@ describe('Tracking page tests', () => { cy.get('[data-cy=questions-list-0]').click() - cy.contains('1. Degree programmes include model schedules in curricula that support understanding of the education system, study paths, and course offerings').click() + cy.contains( + '1. Degree programmes include model schedules in curricula that support understanding of the education system, study paths, and course offerings', + ).click() cy.get('[data-cy=send-selection-button]').click() cy.get('[data-cy=accordion-group-0]').click() @@ -89,4 +93,4 @@ describe('Tracking page tests', () => { cy.get(`[data-cy=square-${testFacultyCode}-1]`).click() cy.contains('01.01.2000').should('exist') }) -}) \ No newline at end of file +})