From 54728c373cab3e8b48254716627fe2ebfc7f5f45 Mon Sep 17 00:00:00 2001 From: Valtteri Kantanen Date: Fri, 23 Aug 2024 15:53:39 +0300 Subject: [PATCH] [Filters] Fix programme filter --- cypress/e2e/Filters.js | 4 ++-- .../src/components/FilterView/filters/programmes.jsx | 8 +++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/cypress/e2e/Filters.js b/cypress/e2e/Filters.js index 587a3c1d71..4408926902 100644 --- a/cypress/e2e/Filters.js +++ b/cypress/e2e/Filters.js @@ -287,7 +287,7 @@ describe('Course Statistics', () => { it('Programme filter works', () => { runTestStepWithPreAndPostParts('Programme', () => { const card = cy.cs('Programme-filter-card') - const programmeDropdown = card.cs('Programme-filter-dropdown').selectFromDropdown(1) + const programmeDropdown = card.cs('Programme-filter-dropdown').selectFromDropdown(2) checkFilteringResult(116) programmeDropdown.get('i.delete').click() }) @@ -367,7 +367,7 @@ describe('Custom Population Statistics', () => { it('Programme filter works', () => { runTestStepWithPreAndPostParts('Programme', () => { const card = cy.cs('Programme-filter-card') - const programmeDropdown = card.cs('Programme-filter-dropdown').selectFromDropdown(0) + const programmeDropdown = card.cs('Programme-filter-dropdown').selectFromDropdown(1) checkFilteringResult(3) programmeDropdown.get('i.delete').click() }) diff --git a/services/frontend/src/components/FilterView/filters/programmes.jsx b/services/frontend/src/components/FilterView/filters/programmes.jsx index a10626062b..ea8b2ba81f 100644 --- a/services/frontend/src/components/FilterView/filters/programmes.jsx +++ b/services/frontend/src/components/FilterView/filters/programmes.jsx @@ -127,11 +127,9 @@ const ProgrammeFilterCard = ({ additionalModes, onOptionsChange, options, studen } const getStudentProgrammes = student => - (student?.studyRights ?? []) - .flatMap(studyRight => - studyRight.studyRightElements.map(element => ({ ...element, cancelled: studyRight.cancelled })) - ) - .filter(element => element.degreeProgrammeType != null) + (student?.studyRights ?? []).flatMap(studyRight => + studyRight.studyRightElements.map(element => ({ ...element, cancelled: studyRight.cancelled })) + ) const createStudentToProgrammeMap = (students, studyRightPredicate) => { const studentToProgrammeMap = {}