fix: enrollments serializer for multiple courses #168
Labels
important
Takes priority over other tasks
on staging
Task is implemented and deployed to staging, but not to production
We've thought of this the wrong way 😒
CourseScoreAndCertificateSerializer
contains the optional fieldexam_scores
; which requires runningcollect_grading_info
before rendering it.LearnerDetailsForCourseSerializer
is doing that cleanly here.We changed the logic of the collector to support multiple courses here. And that's a mistake 🤕 ! The report should not include more than one course if
exam_scores
is requested. Each course has its own set of columns; having all columns of all selected courses in the header is a very bad idea. Sorry, it just didn't cross my mind before now!What's the goal we want to achieve, from the user perspective?
course_ids
containing one-and-only-one course; then the response can include exam scores columns when usingoptional_fields_tags=csv_export
course_ids
containing more than one course, or called withoutcourse_ids
; then the response will not include exam scores columns even ifoptional_fields_tags=csv_export
is usedHow to do that in the code?
collect_grading_info
. It should support only one coursecourse_ids
inLearnerEnrollmentSerializer
. If it does not contain one-and-only-one course-id; then removeexam_scores
fromrequested_optional_field_tags
of the serializer's context (if requested). See how this method checks for requested tagsThe text was updated successfully, but these errors were encountered: