Skip to content

Clear resource_type filter when leaving Learning Materials search tab #1780

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 12, 2024

Conversation

mbertrand
Copy link
Member

What are the relevant tickets?

Closes https://github.com/mitodl/hq/issues/5333

Description (What does it do?)

If you are on the "Learning Materials" tab of the search page with resource_type filters selected ("Video" for example), then switch to another tab, the resource_type filter should be cleared, but not other filters like topic.

How can this be tested?

@mbertrand mbertrand added the Needs Review An open Pull Request that is ready for review label Oct 31, 2024
@abeglova abeglova self-assigned this Nov 1, 2024
Copy link
Contributor

@abeglova abeglova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works great. Should the counts for the tabs also ignore the resource_type filter setting? That way the count will be the number of resources the user will see if they click on the tab:

If so, you should replace the following lines with
https://github.com/mitodl/mit-learn/blob/main/learning_resources_search/api.py#L489-L491 with:

            ignored_keys = ["resource_type", 'resource_category'] if aggregation == "resource_category " else [aggregation]
            other_filters = [
                filter_clauses[key] for key in filter_clauses if not key in ignored_keys
            ]

@mbertrand
Copy link
Member Author

@abeglova thanks, I tried that suggestion but when I select a resource type facet like "Podcast", the course/program tab counts remain the same (which is good) but so does the learning material tab count (not good?):

podcast count: 22, tab count 1154

Screenshot 2024-11-01 154936

@abeglova
Copy link
Contributor

abeglova commented Nov 1, 2024

Oh yeah - you are right . So maybe what you have is better

@abeglova
Copy link
Contributor

abeglova commented Nov 1, 2024

I guess we can make two seperate aggregations and combine them but maybe that's also confusing. What you have is probably the least bad solution

@mbertrand mbertrand force-pushed the mb/clear_resource_type branch from 732a726 to 953952b Compare November 12, 2024 13:24
@mbertrand mbertrand merged commit da4b0e7 into main Nov 12, 2024
11 checks passed
This was referenced Nov 14, 2024
@rhysyngsun rhysyngsun deleted the mb/clear_resource_type branch February 7, 2025 20:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Review An open Pull Request that is ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants