Skip to content

Conversation

@abeglova
Copy link
Contributor

@abeglova abeglova commented Jun 28, 2024

What are the relevant tickets?

closes https://github.com/mitodl/hq/issues/4727

Description (What does it do?)

This pr adds resource_category as a serializer field and a filter for the /learning_resource and /learning_resources_search apis. It removes is_learning_material as a filter and aggregation for /learning_resources_search

How can this be tested?

Run docker-compose run web ./manage.py recreate_index --all

Go to http://localhost:8063/api/v1/learning_resources/
Verify that the resource_category filter works, for example http://localhost:8063/api/v1/learning_resources/?resource_category=learning+material

Got to http://localhost:8063/api/v1/learning_resources_search
Verify that the resource_category filter works, for example http://localhost:8063/api/v1/learning_resources_search/?resource_category=learning+material
Verify that aggregations work with resource_category http://localhost:8063/api/v1/learning_resources_search/?aggregations=resource_category

Go to http://localhost:8063/api/v1/schema/redoc and verify that the documentation looks good

@abeglova abeglova changed the title Ab/resource category resource category Jun 28, 2024
},
},
"free": {"type": "boolean"},
"is_learning_material": {"type": "boolean"},
Copy link
Contributor Author

Choose a reason for hiding this comment

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

is_learning_material is staying in the index (but not shown in the results) since it is used in the default search. I forgot to add it to the mapping previously

@abeglova abeglova marked this pull request as ready for review June 28, 2024 15:25
@abeglova abeglova added the Needs Review An open Pull Request that is ready for review label Jun 28, 2024
@ChristopherChudzicki ChristopherChudzicki self-assigned this Jun 28, 2024
Copy link
Contributor

@ChristopherChudzicki ChristopherChudzicki left a comment

Choose a reason for hiding this comment

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

LGTM 👍 Just the suggestion about underscore vs space

video_playlist = "Video Playlist"


LEARNING_MATERIAL_RESOURCE_CATEGORY = "learning material"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
LEARNING_MATERIAL_RESOURCE_CATEGORY = "learning material"
LEARNING_MATERIAL_RESOURCE_CATEGORY = "learning_material"

@abeglova abeglova force-pushed the ab/resource_category branch from 27481da to b5b76b4 Compare June 28, 2024 17:43
@blarghmatey
Copy link
Member

pre-commit.ci run

@abeglova abeglova merged commit 635a79d into main Jun 28, 2024
@odlbot odlbot mentioned this pull request Jul 1, 2024
17 tasks
@odlbot odlbot mentioned this pull request Jul 1, 2024
19 tasks
@rhysyngsun rhysyngsun deleted the ab/resource_category branch February 7, 2025 20:31
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.

4 participants