diff --git a/edx_sga/sga.py b/edx_sga/sga.py index 9262f3e6..f216c90a 100644 --- a/edx_sga/sga.py +++ b/edx_sga/sga.py @@ -779,6 +779,7 @@ def student_state(self): "max_score": self.max_score(), "upload_allowed": self.upload_allowed(submission_data=submission), "solution": solution, + 'weight': self.weight, "base_asset_url": StaticContent.get_base_url_path_for_course_assets(self.location.course_key), } diff --git a/edx_sga/tests/integration_tests.py b/edx_sga/tests/integration_tests.py index e06d119e..018c7aa2 100644 --- a/edx_sga/tests/integration_tests.py +++ b/edx_sga/tests/integration_tests.py @@ -233,7 +233,7 @@ def test_student_view(self, fragment, render_template): """ Test student view renders correctly. """ - block = self.make_one("Custom name") + block = self.make_one("Custom name", weight=12) self.personalize(block, **self.make_student(block, 'fred')) fragment = block.student_view() render_template.assert_called_once() @@ -256,6 +256,7 @@ def test_student_view(self, fragment, render_template): self.assertEqual(student_state['upload_allowed'], True) self.assertEqual(student_state['max_score'], 100) self.assertEqual(student_state['graded'], None) + assert student_state['weight'] == 12 fragment.add_css.assert_called_once_with( DummyResource("static/css/edx_sga.css")) fragment.initialize_js.assert_called_once_with(