From 76d227a898e3d1b548faac20b01269da95405b21 Mon Sep 17 00:00:00 2001 From: awais qureshi Date: Thu, 10 Oct 2024 17:16:20 +0500 Subject: [PATCH] feat!: upgrading api to DRF. --- lms/djangoapps/instructor/views/api.py | 4 ++-- lms/djangoapps/instructor/views/serializer.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lms/djangoapps/instructor/views/api.py b/lms/djangoapps/instructor/views/api.py index 5b0e4a7b0fd1..77f76dec9bf8 100644 --- a/lms/djangoapps/instructor/views/api.py +++ b/lms/djangoapps/instructor/views/api.py @@ -2088,10 +2088,9 @@ def post(self, request, course_id): # lint-amnesty, pylint: disable=missing-fun - score a value unique_student_identifier student username or email. """ - course_key = CourseKey.from_string(course_id) - serializer_data = self.serializer_class(data=request.data) + if not serializer_data.is_valid(): return HttpResponseBadRequest(reason=serializer_data.errors) @@ -2120,6 +2119,7 @@ def post(self, request, course_id): # lint-amnesty, pylint: disable=missing-fun 'problem_to_reset': problem_to_reset, 'student': student_identifier } + try: task_api.submit_override_score( request, diff --git a/lms/djangoapps/instructor/views/serializer.py b/lms/djangoapps/instructor/views/serializer.py index da422a051b57..b48f6de3136b 100644 --- a/lms/djangoapps/instructor/views/serializer.py +++ b/lms/djangoapps/instructor/views/serializer.py @@ -237,6 +237,6 @@ class ProblemSerializer(UniqueStudentIdentifierSerializer): 'blank': _("Problem URL name cannot be blank."), } ) - score = serializers.BooleanField( - help_text=_("new score value"), + score = serializers.CharField( + help_text="Score must be a valid number or decimal, e.g., 1.00" )