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

fix: enrollments serializer for multiple courses #168

Open
shadinaif opened this issue Dec 18, 2024 · 0 comments
Open

fix: enrollments serializer for multiple courses #168

shadinaif opened this issue Dec 18, 2024 · 0 comments
Assignees
Labels
important Takes priority over other tasks on staging Task is implemented and deployed to staging, but not to production

Comments

@shadinaif
Copy link
Collaborator

We've thought of this the wrong way 😒

CourseScoreAndCertificateSerializer contains the optional field exam_scores; which requires running collect_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?

  • if the enrollment API is called with course_ids containing one-and-only-one course; then the response can include exam scores columns when using optional_fields_tags=csv_export
  • if the enrollment API is called with course_ids containing more than one course, or called without course_ids; then the response will not include exam scores columns even if optional_fields_tags=csv_export is used

How to do that in the code?

  • Revert the support for multiple courses in collect_grading_info. It should support only one course
  • Check for course_ids in LearnerEnrollmentSerializer. If it does not contain one-and-only-one course-id; then remove exam_scores from requested_optional_field_tags of the serializer's context (if requested). See how this method checks for requested tags
@shadinaif shadinaif added the important Takes priority over other tasks label Dec 18, 2024
@shadinaif shadinaif added test on production Being tested on production server on staging Task is implemented and deployed to staging, but not to production and removed test on production Being tested on production server labels Dec 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
important Takes priority over other tasks on staging Task is implemented and deployed to staging, but not to production
Projects
None yet
Development

No branches or pull requests

2 participants