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: enrollment api to remove exam scores for multiple courses #173

Merged
merged 2 commits into from
Dec 25, 2024

Conversation

tehreem-sadat
Copy link
Collaborator

@tehreem-sadat tehreem-sadat commented Dec 23, 2024

Related Issue: #168

@tehreem-sadat tehreem-sadat force-pushed the tehreem/fix_enrollment_api_for_exam_scores branch from afd4870 to e069f9d Compare December 23, 2024 14:03
@tehreem-sadat tehreem-sadat force-pushed the tehreem/fix_enrollment_api_for_exam_scores branch from e069f9d to d65a8d5 Compare December 23, 2024 14:07
if self.context.get('course_id'):
self.collect_grading_info()
else:
self.fields.pop('exam_scores', None)
Copy link
Collaborator

@shadinaif shadinaif Dec 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fields is a cached property in DRF cached_property, which is not predictable at all. Please pop out exam_scores from requested_optional_field_tags. That will be the safest way to deal with it

Suggested change
self.fields.pop('exam_scores', None)
tags = self.context.get('requested_optional_field_tags'):
if tags:
self.context['requested_optional_field_tags'] = list(set(tags) - {'exam_scores'})

(False, ['__all__']),
(False, ['csv_export']),
])
def test_learner_enrollment_serializer_exam_scores(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ great test, thank you!

@tehreem-sadat tehreem-sadat force-pushed the tehreem/fix_enrollment_api_for_exam_scores branch from d65a8d5 to 256272a Compare December 24, 2024 08:50
@tehreem-sadat tehreem-sadat force-pushed the tehreem/fix_enrollment_api_for_exam_scores branch from 256272a to 9db37b1 Compare December 24, 2024 09:56
@tehreem-sadat tehreem-sadat force-pushed the tehreem/fix_enrollment_api_for_exam_scores branch from 9db37b1 to a07ef12 Compare December 24, 2024 09:58
Copy link
Collaborator

@shadinaif shadinaif left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @tehreem-sadat 👍🏼

@shadinaif shadinaif merged commit 6854d71 into main Dec 25, 2024
4 checks passed
@shadinaif shadinaif deleted the tehreem/fix_enrollment_api_for_exam_scores branch December 25, 2024 08:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants