-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
fix: remove instructor info serializer validation #34802
fix: remove instructor info serializer validation #34802
Conversation
@@ -40,7 +26,7 @@ class CourseDetailsSerializer(serializers.Serializer): | |||
entrance_exam_enabled = serializers.CharField(allow_blank=True) | |||
entrance_exam_id = serializers.CharField(allow_blank=True) | |||
entrance_exam_minimum_score_pct = serializers.CharField(allow_blank=True) | |||
instructor_info = InstructorsSerializer() | |||
instructor_info = serializers.DictField(allow_empty=True) |
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.
instructor_info = serializers.DictField(allow_empty=True) | |
instructor_info = InstructorsSerializer(allow_empty=True) |
I think that it makes sense to keep the serializer validation so that only the expected information comes through when it is present. I agree with allowing the serializer to be empty.
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 problem I'm seeing with this is in the case when instructor_info
isn't empty, we're not necessarily getting the instructors
field.
I've seen the following, so I think it's possible to get instructors
in other languages too.
"instructor_info": {
"Professeurs": []
}
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 MFE version of the schedule and details page does not allow for the instructor key to be saved in other languages. The frontend expects that the key is in English. The key in varying languages is a bug introduced in the legacy page because of how it handled translations.
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.
I see... we still have some corrupt data due to the legacy page then. If we are turning off the MFE and using legacy from time to time due to issues, would it be better to accept the corrupt data for now? When the serializer runs into an issue, it entirely shuts down course details.
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.
Adding allow_empty
should fix the issue for when there is corrupt data. In the edge case that you pointed out, Proffesseurs
is filtered out so instructor_info
was empty. With this change, an empty dict will be sent via the API.
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.
Looks like that specific code doesn't work but I get the general idea. I'll look into something that will pass checks.
@KristinAoki I set |
2U Release Notice: This PR has been deployed to the edX staging environment in preparation for a release to production. |
2U Release Notice: This PR has been deployed to the edX production environment. |
Description
This PR removes serializer validation for
instructor_info
on the course details authoring page. Wheninstructor_info
is not fetched properly, the api errors and does not return data to the page.The typical form for
instructor_info
is:The simplest I've seen is:
I've also used
Professeurs
used in place ofinstructors
.Since
instructor_info
comes in so many forms, it is best to just leave it as aDictField
with its children unvalidated.Supporting information
https://2u-internal.atlassian.net/browse/TNL-11484
Testing instructions
Navigate to the course details page of a course and ensure it loads as expected.