-
Notifications
You must be signed in to change notification settings - Fork 3
Refactor course numbers #173
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
Conversation
Codecov Report
@@ Coverage Diff @@
## main #173 +/- ##
===========================================
+ Coverage 60.78% 78.04% +17.25%
===========================================
Files 134 307 +173
Lines 5036 13248 +8212
Branches 905 2161 +1256
===========================================
+ Hits 3061 10339 +7278
- Misses 1876 2645 +769
- Partials 99 264 +165
|
1ffdb81 to
65fa42d
Compare
| """ | ||
| data = super().to_representation(instance) | ||
| if instance.resource_type == LearningResourceType.course.name: | ||
| add_extra_course_number_fields(data["course"]["course_numbers"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The document structure in opensearch will look like this, (with primary and sorted_coursenum excluded from hit results output):
"course": {
"course_numbers": [
{
"value": "4.401",
"department": {
"name": "Architecture",
"department_id": "4"
},
"listing_type": "primary",
"primary": true,
"sort_coursenum": "04.401"
},
{
"value": "4.464",
"department": {
"name": "Architecture",
"department_id": "4"
},
"listing_type": "cross-listed",
"primary": false,
"sort_coursenum": "04.464"
}
]
},@abeglova is this a suitable replacement for department_course_numbers?
What are the relevant tickets?
Closes #138
Description (What does it do?)
course_numbersJSONFieldto theCoursemodel, to be populated in the format:Course.extra_course_numbersfield.course_numberscourse.course_numbersto include ``sorted_coursenumandprimary`.SOURCE_EXCLUDED_FIELDSconstant (which will need to be updated as necessary).How can this be tested?
docker compose up. The migrations should run, and afterward, if you have any existing courses, the API should return results with each course resource having a populated{"course": {"course_numbers"}}section../manage.py recreate_index --allcourse.course_numbersresponsereadable_idSOURCE_EXCLUDED_FIELDS=[]sorted_coursenumandprimaryfields should be shown.