Skip to content
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

Refactor platform/offered_by filtering and serialization for search #240

Merged
merged 1 commit into from
Nov 27, 2023

Conversation

mbertrand
Copy link
Member

@mbertrand mbertrand commented Nov 20, 2023

What are the relevant tickets?

Closes #237
Closes #113
Partially addresses #199

Description (What does it do?)

  • Renames LearningResourcePlatform.platform to LearningResourcePlatform.code
  • Refactors serialization and index schema for platform, offered_by
  • Adjusts db api and search api to both use code property when filtering
  • Adds/updates api schema documentation for the above fields.

How can this be tested?

Run docker compose up, some db migrations will run
Run ./manage.py recreate_index --all

If you haven't already, run the following mgmt commands:

./manage.py backpopulate_prolearn_data
./manage.py backpopulate_mitxonline_data

Try the following URL's they should all work and filter by the specified offeror/platform correctly. The total number of results should be the same, though the order will likely differ unless you add a sortby option.

http://localhost:8063/api/v1/learning_resources/?platform=mitxonline
http://localhost:8063/api/v1/learning_resources_search/?platform=mitxonline

http://localhost:8063/api/v1/learning_resources/?offered_by=mitpe
http://localhost:8063/api/v1/learning_resources_search/?offered_by=mitpe

Check the schema documentation, the codes and values for platform, offered_by, department, and resource type should be documented for both the db and opensearch endpoints.

http://localhost:8063/api/v1/schema/redoc/#tag/learning_resources
http://localhost:8063/api/v1/schema/redoc/#tag/learning_resources_search

Copy link

codecov bot commented Nov 20, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (60887cf) 76.74% compared to head (57e9242) 76.70%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #240      +/-   ##
==========================================
- Coverage   76.74%   76.70%   -0.04%     
==========================================
  Files         306      306              
  Lines       13523    13537      +14     
  Branches     2215     2219       +4     
==========================================
+ Hits        10378    10384       +6     
- Misses       2882     2887       +5     
- Partials      263      266       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mbertrand mbertrand changed the title Reafctor platform/offered_by filtering and serialization for search Refactor platform/offered_by filtering and serialization for search Nov 20, 2023
@mbertrand mbertrand added Needs Review An open Pull Request that is ready for review and removed Work in Progress labels Nov 21, 2023
@abeglova abeglova self-assigned this Nov 27, 2023
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.

LGTM

@abeglova abeglova added Waiting on author and removed Needs Review An open Pull Request that is ready for review labels Nov 27, 2023
@mbertrand mbertrand merged commit 116293f into main Nov 27, 2023
5 checks passed
@mbertrand mbertrand deleted the mb/platform_offered branch January 16, 2024 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants