Skip to content

Commit 09ec044

Browse files
committed
Stop auto-filtering q finder with all option
1 parent 8503691 commit 09ec044

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/app/components/pages/QuestionFinder.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import debounce from "lodash/debounce";
44
import {
55
arrayFromPossibleCsv,
66
EXAM_BOARD,
7+
EXAM_BOARD_NULL_OPTIONS,
78
getFilteredExamBoardOptions,
89
isAda,
910
isLoggedIn,
@@ -15,6 +16,7 @@ import {
1516
SEARCH_RESULTS_PER_PAGE,
1617
siteSpecific,
1718
STAGE,
19+
STAGE_NULL_OPTIONS,
1820
TAG_ID,
1921
tags,
2022
toSimpleCSV,
@@ -119,12 +121,14 @@ export const QuestionFinder = withRouter(({location}: RouteComponentProps) => {
119121
const filtersHaveNotBeenSpecifiedByQueryParams = FILTER_PARAMS.every(p => !params[p]);
120122
if (filtersHaveNotBeenSpecifiedByQueryParams) {
121123
const accountStages = user.registeredContexts?.map(c => c.stage).filter(s => s) as STAGE[];
122-
if (isPhy || accountStages.length === 1) { // Ada only want to apply stages filter if there is only one
124+
const allStagesSelected = accountStages?.some(stage => STAGE_NULL_OPTIONS.includes(stage));
125+
if (!allStagesSelected && (isPhy || accountStages.length === 1)) { // Ada only want to apply stages filter if there is only one
123126
setSearchStages(accountStages);
124127
setPopulatedFromAccountSettings(true);
125128
}
126129
const examBoardStages = user.registeredContexts?.map(c => c.examBoard).filter(e => e) as EXAM_BOARD[];
127-
if (isAda && examBoardStages.length === 1) { // Phy does not have exam boards
130+
const allExamBoardsSelected = examBoardStages?.some(examBoard => EXAM_BOARD_NULL_OPTIONS.includes(examBoard));
131+
if (isAda && !allExamBoardsSelected && examBoardStages.length === 1) { // Phy does not have exam boards
128132
setSearchExamBoards(examBoardStages);
129133
setPopulatedFromAccountSettings(true);
130134
}

0 commit comments

Comments
 (0)