@@ -7,7 +7,7 @@ import { above, ACCOUNT_TAB, ACCOUNT_TABS, AUDIENCE_DISPLAY_FIELDS, below, BOARD
7
7
EventStatusFilter , EventTypeFilter , filterAssignmentsByStatus , filterAudienceViewsByProperties , getDistinctAssignmentGroups , getDistinctAssignmentSetters , getHumanContext , getThemeFromContextAndTags , HUMAN_STAGES ,
8
8
ifKeyIsEnter , isAda , isDefined , PHY_NAV_SUBJECTS , isTeacherOrAbove , QuizStatus , siteSpecific , TAG_ID , tags , STAGE , useDeviceSize , LearningStage , HUMAN_SUBJECTS , ArrayElement , isFullyDefinedContext , isSingleStageContext ,
9
9
Item , stageLabelMap , extractTeacherName , determineGameboardSubjects , PATHS , getQuestionPlaceholder , getFilteredStageOptions ,
10
- isPhy } from "../../../services" ;
10
+ isPhy , TAG_LEVEL } from "../../../services" ;
11
11
import { StageAndDifficultySummaryIcons } from "../StageAndDifficultySummaryIcons" ;
12
12
import { mainContentIdSlice , selectors , useAppDispatch , useAppSelector , useGetQuizAssignmentsAssignedToMeQuery } from "../../../state" ;
13
13
import { Link , useHistory , useLocation } from "react-router-dom" ;
@@ -336,12 +336,12 @@ const FilterCheckbox = (props : FilterCheckboxProps) => {
336
336
337
337
const handleCheckboxChange = ( checked : boolean ) => {
338
338
// Reselect parent if all children are deselected
339
- const siblingTags = tag . type === " field" && incompatibleTags ? tags . getDirectDescendents ( incompatibleTags [ 0 ] . id ) . filter ( t => t !== tag ) : [ ] ;
340
- const reselectParent = siblingTags . length && ! siblingTags . some ( t => conceptFilters . includes ( t ) ) ;
339
+ const siblingTags = tag . type === TAG_LEVEL . field && tag . parent ? tags . getDirectDescendents ( tag . parent ) . filter ( t => t !== tag ) : [ ] ;
340
+ const reselectParent = tag . parent && siblingTags . every ( t => ! conceptFilters . includes ( t ) ) ;
341
341
342
342
const newConceptFilters = checked
343
343
? [ ...conceptFilters . filter ( c => ! incompatibleTags ?. includes ( c ) ) , ...( ! partiallySelected ? [ tag ] : [ ] ) ]
344
- : [ ...conceptFilters . filter ( c => ! [ tag , ...( dependentTags ?? [ ] ) ] . includes ( c ) ) , ...( reselectParent ? [ incompatibleTags ! [ 0 ] ] : [ ] ) ] ;
344
+ : [ ...conceptFilters . filter ( c => ! [ tag , ...( dependentTags ?? [ ] ) ] . includes ( c ) ) , ...( reselectParent ? [ tags . getById ( tag . parent ! ) ] : [ ] ) ] ;
345
345
setConceptFilters ( newConceptFilters . length > 0 ? newConceptFilters : ( baseTag ? [ baseTag ] : [ ] ) ) ;
346
346
} ;
347
347
0 commit comments