This is a follow up on hierarchical facets, more precisely the "Enable parent" feature.

At the moment the parent is selected as soon as one of the childs is unselected.
The expected behavior could be to only select the parent when all of the childs are unselected.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mpp created an issue. See original summary.

borisson_’s picture

To test this, we should add a new test to the HierarchicalFacetIntegrationTest, that test can copy a lot of what is in verifyEnableParentWhenChildGetsDisabledOption

mpp’s picture

Status: Active » Needs review
FileSize
1.33 KB

Before enabling the parent id again, added a check if there are active siblings.

Note that this is quite expensive code, it loops over all results, gets all children and then loops over all results again..
It would be good to have a more performant getSiblings() method or only loop.

I'm aware this still needs test but already marking it for needs review to see if it breaks any other test.

borisson_’s picture

FileSize
1.16 KB
2.49 KB

Test only is also interdiff.

The last submitted patch, 4: 2930958-test-only.patch, failed testing. View results

borisson_’s picture

Status: Needs review » Fixed

Committed and pushed, thanks!

  • borisson_ committed 01ca352 on 8.x-1.x
    Issue #2930958 by borisson_, mpp: Activate the parent only when the last...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.