diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d66e00ea..c4a6b562 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,7 +39,7 @@ jobs: - name: Run Integration Tests run: | cd .. - git clone https://github.com/edx/devstack.git + git clone https://github.com/openedx/devstack cd devstack sed -i 's/:cached//g' ./docker-compose-host.yml make dev.clone.https diff --git a/edx_sga/sga.py b/edx_sga/sga.py index 21b9581e..4d5bca22 100644 --- a/edx_sga/sga.py +++ b/edx_sga/sga.py @@ -653,7 +653,6 @@ def get_student_item_dict(self, student_id=None): """ if student_id is None and (user_service := self.runtime.service(self, 'user')): student_id = user_service.get_current_user().opt_attrs.get(ATTR_KEY_ANONYMOUS_USER_ID) - assert student_id != ("MOCK", "Forgot to call 'personalize' in test.") return { "student_id": student_id, @@ -748,17 +747,9 @@ def student_state(self): Returns a JSON serializable representation of student's state for rendering in client view. """ - graded = None submission = self.get_submission() - if submission: uploaded = {"filename": submission["answer"]["filename"]} - student_item = SubmissionsStudent.objects.get(id = submission.get("student_item")) - score = submissions_api.get_score(student_item.student_item_dict) - if score: - score = score.get("points_earned") - graded = {"score": score, "comment": force_str(self.comment)} - else: uploaded = None @@ -767,6 +758,12 @@ def student_state(self): else: annotated = None + score = self.score + if score is not None: + graded = {"score": score, "comment": force_str(self.comment)} + else: + graded = None + if self.answer_available() and (replace_urls_service := self.runtime.service(self, 'replace_urls')): solution = replace_urls_service.replace_urls(force_str(self.solution)) else: diff --git a/edx_sga/tests/integration_tests.py b/edx_sga/tests/integration_tests.py index 10daf7af..49da0f6a 100644 --- a/edx_sga/tests/integration_tests.py +++ b/edx_sga/tests/integration_tests.py @@ -299,7 +299,8 @@ def test_student_view_with_score(self, fragment, render_template): user = student["module"].student student_id = anonymous_id_for_user(user,self.course_id) - with mock.patch.object(StaffGradedAssignmentXBlock.get_submission,"__defaults__",(student_id,)): + with mock.patch.object(StaffGradedAssignmentXBlock.get_submission,"__defaults__",(student_id,)),\ + mock.patch.object(StaffGradedAssignmentXBlock.get_score, "__defaults__",(student_id,)): fragment = block.student_view() render_template.assert_called_once() template_arg = render_template.call_args[0][0] @@ -308,7 +309,6 @@ def test_student_view_with_score(self, fragment, render_template): self.assertEqual(context["is_course_staff"], True) self.assertEqual(context["id"], "d_0") student_state = json.loads(context["student_state"]) - print(f"state: {student_state}") self.assertEqual(student_state["display_name"], "Staff Graded Assignment") self.assertEqual(student_state["uploaded"], {"filename": "foo.txt"}) self.assertEqual(student_state["annotated"], None)