From a6b80b78d19aab52383d976a483d9db5dcf34fbb Mon Sep 17 00:00:00 2001 From: Maria Grimaldi Date: Tue, 3 Oct 2023 07:24:46 -0400 Subject: [PATCH 01/15] fix: configure editable depending on configs --- mindmap/mindmap.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mindmap/mindmap.py b/mindmap/mindmap.py index e0fc742..826c687 100644 --- a/mindmap/mindmap.py +++ b/mindmap/mindmap.py @@ -300,8 +300,10 @@ def author_view(self, _context=None) -> Fragment: user = self.get_current_user() context = self.get_context() js_context = self.get_js_context(user, context) - context["editable"] = False - js_context["editable"] = False + + if context["has_score"] and not context["can_submit_assignment"]: + context["editable"] = False + js_context["editable"] = False frag = self.load_fragment("mindmap", context) From f4db14f17a6750ab2b40b82f43a88199b50b088e Mon Sep 17 00:00:00 2001 From: Maria Grimaldi Date: Wed, 4 Oct 2023 10:32:19 -0400 Subject: [PATCH 02/15] refactor: allow edition when in studio view --- mindmap/mindmap.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/mindmap/mindmap.py b/mindmap/mindmap.py index 826c687..2838045 100644 --- a/mindmap/mindmap.py +++ b/mindmap/mindmap.py @@ -301,10 +301,6 @@ def author_view(self, _context=None) -> Fragment: context = self.get_context() js_context = self.get_js_context(user, context) - if context["has_score"] and not context["can_submit_assignment"]: - context["editable"] = False - js_context["editable"] = False - frag = self.load_fragment("mindmap", context) frag.add_javascript(self.resource_string("public/js/src/requiredModules.js")) From 81be23ec2497bafed49f753705efb371027c5107 Mon Sep 17 00:00:00 2001 From: Maria Grimaldi Date: Fri, 29 Sep 2023 15:09:22 -0400 Subject: [PATCH 03/15] feat: consider weight in score calculation --- mindmap/mindmap.py | 63 ++++++++++++++++++++------------ mindmap/public/html/mindmap.html | 8 ++-- mindmap/public/js/src/mindmap.js | 8 ++-- mindmap/tests/test_mindmap.py | 6 +-- 4 files changed, 51 insertions(+), 34 deletions(-) diff --git a/mindmap/mindmap.py b/mindmap/mindmap.py index 2838045..159a5e8 100644 --- a/mindmap/mindmap.py +++ b/mindmap/mindmap.py @@ -4,6 +4,7 @@ import json import logging +import math from enum import Enum import pkg_resources @@ -109,13 +110,13 @@ class MindMapXBlock(XBlock, CompletableXBlockMixin): scope=Scope.user_state, ) - weight = Float( + weight = Integer( display_name=_("Problem Weight"), help=_( "Defines the number of points this problem is worth. If " "the value is not set, the problem is worth one point." ), - values={"min": 0, "step": 0.1}, + default=1, scope=Scope.settings, ) @@ -149,17 +150,30 @@ def block_course_id(self): return str(self.course_id) @property - def score(self): + def raw_score(self): """ Return score from submissions. """ - return self.get_score() + return self.get_raw_score() + + def get_weighted_score(self, student_id=None): + """ + Return weighted score from submissions. + """ + # Lazy import: import here to avoid app not ready errors + from submissions.api import get_score # pylint: disable=import-outside-toplevel + + score = get_score(self.get_student_item_dict(student_id)) + if score: + return score["points_earned"] + + return None def max_score(self): """ Return the maximum score. """ - return self.points + return self.weight def get_current_user(self): """ @@ -235,8 +249,8 @@ def get_context(self, in_student_view=False): if self.has_score: context.update({ "can_submit_assignment": self.submit_allowed(), - "score": self.score, - "max_score": self.max_score(), + "raw_score": self.raw_score, + "max_raw_score": self.points, }) return context @@ -253,7 +267,7 @@ def get_js_context(self, user, context): """ return { "author": user.full_name, - "max_points": self.points, + "max_raw_score": self.points, "mind_map": self.get_current_mind_map(), "editable": context["editable"], "xblock_id": self.scope_ids.usage_id.block_id, @@ -498,7 +512,7 @@ def get_student_data() -> dict: user = user_by_anonymous_id(student.student_id) student_module = self.get_or_create_student_module(user) state = json.loads(student_module.state) - score = self.get_score(student.student_id) + raw_score = self.get_raw_score(student.student_id) if state.get("submission_status") in [ SubmissionStatus.COMPLETED.value, SubmissionStatus.SUBMITTED.value @@ -512,13 +526,17 @@ def get_student_data() -> dict: "timestamp": submission["created_at"].strftime( DateTime.DATETIME_FORMAT ), - "score": score, + "raw_score": raw_score, + "max_raw_score": self.points, + "weight": self.weight, + "weighted_score": self.get_weighted_score(student.student_id), "submission_status": state.get("submission_status"), } return { "assignments": list(get_student_data()), - "max_score": self.max_score(), + "max_raw_score": self.points, + "weight": self.weight, "display_name": self.display_name, } @@ -565,14 +583,14 @@ def enter_grade(self, data, _suffix="") -> dict: require(self.is_course_team) - score = int(data.get("grade")) + raw_score = int(data.get("grade")) uuid = data.get("submission_id") - if not score or not uuid: + if not raw_score or not uuid: raise JsonHandlerError(400, "Missing required parameters") - if score > self.max_score(): + if raw_score > self.points: raise JsonHandlerError(400, "Score cannot be greater than max score") - set_score(uuid, score, self.max_score()) + set_score(uuid, math.ceil((raw_score / self.points) * self.weight), self.weight) self.update_student_state( data.get("module_id"), SubmissionStatus.COMPLETED.value @@ -632,7 +650,7 @@ def validate_score(points: int, weight: int) -> None: if weight: try: - weight = float(weight) + weight = int(weight) except ValueError as exc: raise JsonHandlerError(400, "Weight must be a decimal number") from exc if weight < 0: @@ -653,11 +671,11 @@ def submit_allowed(self) -> bool: """ return ( not self.past_due() - and self.score is None + and self.raw_score is None and self.submission_status == SubmissionStatus.NOT_ATTEMPTED.value ) - def get_score(self, student_id=None) -> int: + def get_raw_score(self, student_id=None) -> int: """ Return student's current score. @@ -667,12 +685,9 @@ def get_score(self, student_id=None) -> int: Returns: int: The student's current score. """ - # Lazy import: import here to avoid app not ready errors - from submissions.api import get_score # pylint: disable=import-outside-toplevel - - score = get_score(self.get_student_item_dict(student_id)) - if score: - return score["points_earned"] + weighted_score = self.get_weighted_score(student_id) + if weighted_score: + return math.ceil((weighted_score * self.points) / self.weight) return None diff --git a/mindmap/public/html/mindmap.html b/mindmap/public/html/mindmap.html index fdb00f8..d8d2c43 100644 --- a/mindmap/public/html/mindmap.html +++ b/mindmap/public/html/mindmap.html @@ -53,10 +53,10 @@
-{% if not is_static and has_score and not score and in_student_view %} -

(0/{{ max_score }} {% trans "points" %}) {% trans submission_status %}

-{% elif not is_static and has_score and score and in_student_view %} -

({{ score }}/{{ max_score }} {% trans "points" %}) {% trans submission_status %}

+{% if not is_static and has_score and not raw_score and in_student_view %} +

(0/{{ max_raw_score }} {% trans "points" %}) {% trans submission_status %}

+{% elif not is_static and has_score and raw_score and in_student_view %} +

({{ raw_score }}/{{ max_raw_score }} {% trans "points" %}) {% trans submission_status %}

{% endif %} {% if editable and in_student_view and can_submit_assignment %} diff --git a/mindmap/public/js/src/mindmap.js b/mindmap/public/js/src/mindmap.js index 705806b..8abe92f 100644 --- a/mindmap/public/js/src/mindmap.js +++ b/mindmap/public/js/src/mindmap.js @@ -5,7 +5,7 @@ function MindMapXBlock(runtime, element, context) { const getGradingDataURL = runtime.handlerUrl(element, "get_instructor_grading_data"); const enterGradeURL = runtime.handlerUrl(element, "enter_grade"); const removeGradeURL = runtime.handlerUrl(element, "remove_grade"); - const maxPointsAllowed = context.max_points; + const maxPointsAllowed = context.max_raw_score; let gettext; if ("MindMapI18N" in window || "gettext" in window) { @@ -84,7 +84,8 @@ function MindMapXBlock(runtime, element, context) { gettext("Username"), gettext("Uploaded"), gettext("Submission Status"), - gettext("Grade"), + gettext("Raw score"), + gettext("Weighted score"), gettext("Actions"), ]; @@ -131,7 +132,8 @@ function MindMapXBlock(runtime, element, context) { return gettext(data); }, }, - { data: "score" }, + { data: "raw_score" }, + { data: "weighted_score" }, { data: null, render: () => { diff --git a/mindmap/tests/test_mindmap.py b/mindmap/tests/test_mindmap.py index 21e4c2d..bcf5cc5 100644 --- a/mindmap/tests/test_mindmap.py +++ b/mindmap/tests/test_mindmap.py @@ -85,7 +85,7 @@ def test_student_view_with_mind_map(self, initialize_js_mock: Mock): "mind_map": self.mind_map, "editable": self.editable_mind_map, "xblock_id": self.xblock.scope_ids.usage_id.block_id, - "max_points": self.xblock.points, + "max_raw_score": self.xblock.points, } self.xblock.student_view() @@ -129,7 +129,7 @@ def test_student_view_empty_mind_map(self, initialize_js_mock: Mock): "mind_map": None, "editable": self.editable_mind_map, "xblock_id": self.xblock.scope_ids.usage_id.block_id, - "max_points": self.xblock.points, + "max_raw_score": self.xblock.points, } self.xblock.student_view() @@ -326,7 +326,7 @@ def test_student_not_allowed_submission(self, initialize_js_mock: Mock): "mind_map": self.mind_map, "editable": False, "xblock_id": block_id, - "max_points": self.xblock.points, + "max_raw_score": self.xblock.points, } self.xblock.student_view() From cba28f2af62b2206ef10fa2b1076ceb6febd7325 Mon Sep 17 00:00:00 2001 From: Maria Grimaldi Date: Mon, 2 Oct 2023 16:22:14 -0400 Subject: [PATCH 04/15] fix: refactor tests so match latest implementation --- mindmap/tests/test_mindmap.py | 47 +++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/mindmap/tests/test_mindmap.py b/mindmap/tests/test_mindmap.py index bcf5cc5..3359ac2 100644 --- a/mindmap/tests/test_mindmap.py +++ b/mindmap/tests/test_mindmap.py @@ -34,7 +34,8 @@ def setUp(self) -> None: self.xblock.resource_string = Mock() self.xblock.submit_allowed = Mock(return_value=True) self.xblock.past_due = Mock(return_value=False) - self.xblock.get_score = Mock(return_value=0) + self.xblock.get_raw_score = Mock(return_value=50) + self.xblock.get_weighted_score = Mock(return_value=0.50) self.xblock.get_current_user = Mock(return_value=self.student) self.xblock.show_staff_grading_interface = Mock(return_value=False) self.xblock.display_name = "Test MindMap" @@ -74,11 +75,11 @@ def test_student_view_with_mind_map(self, initialize_js_mock: Mock): "is_static": self.xblock.is_static, "is_static_field": self.xblock.fields["is_static"], "can_submit_assignment": True, - "score": 0, - "max_score": self.xblock.max_score(), "has_score": True, "has_score_field": self.xblock.fields["has_score"], "submission_status": self.xblock.submission_status, + "raw_score": 50, + "max_raw_score": self.xblock.points, } expected_js_context = { "author": self.student.full_name, @@ -118,11 +119,11 @@ def test_student_view_empty_mind_map(self, initialize_js_mock: Mock): "is_static": self.xblock.is_static, "is_static_field": self.xblock.fields["is_static"], "can_submit_assignment": True, - "score": 0, - "max_score": self.xblock.max_score(), "has_score": True, "has_score_field": self.xblock.fields["has_score"], "submission_status": self.xblock.submission_status, + "raw_score": 50, + "max_raw_score": self.xblock.points, } expected_js_context = { "author": self.student.full_name, @@ -162,11 +163,11 @@ def test_static_mind_map_in_student_view(self): "is_static": self.xblock.is_static, "is_static_field": self.xblock.fields["is_static"], "can_submit_assignment": True, - "score": 0, - "max_score": self.xblock.max_score(), "has_score": True, "has_score_field": self.xblock.fields["has_score"], "submission_status": self.xblock.submission_status, + "raw_score": 50, + "max_raw_score": self.xblock.points, } self.xblock.student_view() @@ -197,12 +198,12 @@ def test_student_view_for_instructor(self): "is_static": self.xblock.is_static, "is_static_field": self.xblock.fields["is_static"], "can_submit_assignment": True, - "score": 0, - "max_score": self.xblock.max_score(), "is_instructor": True, "has_score": True, "has_score_field": self.xblock.fields["has_score"], "submission_status": self.xblock.submission_status, + "raw_score": 50, + "max_raw_score": self.xblock.points, } self.xblock.student_view() @@ -234,15 +235,15 @@ def test_studio_view(self): "is_static": self.xblock.is_static, "is_static_field": self.xblock.fields["is_static"], "can_submit_assignment": True, - "score": 0, "points": 100, "points_field": self.xblock.fields["points"], "weight": 1, "weight_field": self.xblock.fields["weight"], - "max_score": self.xblock.max_score(), "has_score": True, "has_score_field": self.xblock.fields["has_score"], "submission_status": self.xblock.submission_status, + "raw_score": 50, + "max_raw_score": self.xblock.points, } self.xblock.studio_view() @@ -315,11 +316,11 @@ def test_student_not_allowed_submission(self, initialize_js_mock: Mock): "is_static": self.xblock.is_static, "is_static_field": self.xblock.fields["is_static"], "can_submit_assignment": False, - "score": 0, - "max_score": self.xblock.max_score(), "has_score": True, "has_score_field": self.xblock.fields["has_score"], "submission_status": self.xblock.submission_status, + "raw_score": 50, + "max_raw_score": self.xblock.points, } expected_js_context = { "author": self.student.full_name, @@ -362,7 +363,8 @@ def setUp(self) -> None: status_code_success=HTTPStatus.OK, ) self.student_id = "test-student-id" - self.grade = 100 + self.raw_grade = 50 + self.weighted_grade = 1 self.submission_id = "test-submission-id" def test_studio_submit(self): @@ -455,7 +457,7 @@ def test_enter_grade(self, set_score_mock: Mock, get_student_module_mock: Mock): """ self.request.body = json.dumps( { - "grade": self.grade, + "grade": self.raw_grade, "submission_id": self.submission_id } ).encode("utf-8") @@ -469,8 +471,8 @@ def test_enter_grade(self, set_score_mock: Mock, get_student_module_mock: Mock): self.assertEqual(HTTPStatus.OK, response.status_code) set_score_mock.assert_called_once_with( self.submission_id, - self.grade, - self.xblock.max_score(), + self.weighted_grade, + self.xblock.weight, ) @patch("mindmap.mindmap.MindMapXBlock.get_student_module") @@ -512,10 +514,9 @@ def test_get_instructor_grading_data( Expected result: - The student view is rendered with the appropriate values. """ - self.xblock.get_score.return_value = 50 student_item_mock.objects.filter.return_value = [ Mock( - grade=self.xblock.score, + grade=self.xblock.raw_score, student_id=self.student.student_id, ), ] @@ -544,13 +545,17 @@ def test_get_instructor_grading_data( }, "username": self.student.student_id, "timestamp": current_datetime.strftime(DateTime.DATETIME_FORMAT), - "score": 50, + "raw_score": self.xblock.raw_score, + "max_raw_score": self.xblock.points, + "weight": self.xblock.weight, + "weighted_score": self.xblock.get_weighted_score(), "submission_status": self.xblock.submission_status, }, ], "display_name": self.xblock.display_name, - "max_score": self.xblock.max_score(), + "max_raw_score": self.xblock.points, + "weight": self.xblock.weight, } get_or_create_student_module_mock.return_value = Mock( state='{"submission_status": "Submitted"}', id=module_id, From e24cdde8c62a5a5ad1cd1d82ca93160bb36c6b0e Mon Sep 17 00:00:00 2001 From: Maria Grimaldi Date: Mon, 2 Oct 2023 16:49:56 -0400 Subject: [PATCH 05/15] refactor: show weight in scoring table view --- mindmap/mindmap.py | 4 +++- mindmap/public/js/src/mindmap.js | 21 +++++++++++++++++++-- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/mindmap/mindmap.py b/mindmap/mindmap.py index 159a5e8..d2af464 100644 --- a/mindmap/mindmap.py +++ b/mindmap/mindmap.py @@ -14,7 +14,7 @@ from xblock.completable import CompletableXBlockMixin from xblock.core import XBlock from xblock.exceptions import JsonHandlerError -from xblock.fields import Boolean, DateTime, Dict, Float, Integer, Scope, String +from xblock.fields import Boolean, DateTime, Dict, Integer, Scope, String from xblockutils.resources import ResourceLoader from mindmap.edxapp_wrapper.student import ( @@ -251,6 +251,7 @@ def get_context(self, in_student_view=False): "can_submit_assignment": self.submit_allowed(), "raw_score": self.raw_score, "max_raw_score": self.points, + "weight": self.weight, }) return context @@ -268,6 +269,7 @@ def get_js_context(self, user, context): return { "author": user.full_name, "max_raw_score": self.points, + "weight": self.weight, "mind_map": self.get_current_mind_map(), "editable": context["editable"], "xblock_id": self.scope_ids.usage_id.block_id, diff --git a/mindmap/public/js/src/mindmap.js b/mindmap/public/js/src/mindmap.js index 8abe92f..e57ce31 100644 --- a/mindmap/public/js/src/mindmap.js +++ b/mindmap/public/js/src/mindmap.js @@ -6,6 +6,7 @@ function MindMapXBlock(runtime, element, context) { const enterGradeURL = runtime.handlerUrl(element, "enter_grade"); const removeGradeURL = runtime.handlerUrl(element, "remove_grade"); const maxPointsAllowed = context.max_raw_score; + const problemWeight = context.weight; let gettext; if ("MindMapI18N" in window || "gettext" in window) { @@ -132,8 +133,24 @@ function MindMapXBlock(runtime, element, context) { return gettext(data); }, }, - { data: "raw_score" }, - { data: "weighted_score" }, + { + data: "raw_score", + render: (data) => { + if (data === null) { + return ""; + } + return `${data}/${maxPointsAllowed}`; + }, + }, + { + data: "weighted_score", + render: (data) => { + if (data === null) { + return ""; + } + return `${data}/${problemWeight}`; + }, + }, { data: null, render: () => { From ada56e896491642a399f9712728b727fd3c5bca5 Mon Sep 17 00:00:00 2001 From: Maria Grimaldi Date: Tue, 3 Oct 2023 09:04:41 -0400 Subject: [PATCH 06/15] refactor: use different default and round to nearest int --- mindmap/mindmap.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/mindmap/mindmap.py b/mindmap/mindmap.py index d2af464..efca3d7 100644 --- a/mindmap/mindmap.py +++ b/mindmap/mindmap.py @@ -4,7 +4,6 @@ import json import logging -import math from enum import Enum import pkg_resources @@ -116,7 +115,7 @@ class MindMapXBlock(XBlock, CompletableXBlockMixin): "Defines the number of points this problem is worth. If " "the value is not set, the problem is worth one point." ), - default=1, + default=10, scope=Scope.settings, ) @@ -592,7 +591,7 @@ def enter_grade(self, data, _suffix="") -> dict: if raw_score > self.points: raise JsonHandlerError(400, "Score cannot be greater than max score") - set_score(uuid, math.ceil((raw_score / self.points) * self.weight), self.weight) + set_score(uuid, round((raw_score / self.points) * self.weight), self.weight) self.update_student_state( data.get("module_id"), SubmissionStatus.COMPLETED.value @@ -689,7 +688,7 @@ def get_raw_score(self, student_id=None) -> int: """ weighted_score = self.get_weighted_score(student_id) if weighted_score: - return math.ceil((weighted_score * self.points) / self.weight) + return round((weighted_score * self.points) / self.weight) return None From 244b17d788dc0564a66d6bdccbb1ce67035d4e31 Mon Sep 17 00:00:00 2001 From: Maria Grimaldi Date: Wed, 4 Oct 2023 12:37:33 -0400 Subject: [PATCH 07/15] feat: add support for course completion --- mindmap/mindmap.py | 1 + 1 file changed, 1 insertion(+) diff --git a/mindmap/mindmap.py b/mindmap/mindmap.py index efca3d7..9f43b73 100644 --- a/mindmap/mindmap.py +++ b/mindmap/mindmap.py @@ -448,6 +448,7 @@ def submit_assignment(self, data, _suffix="") -> dict: } student_item_dict = self.get_student_item_dict() create_submission(student_item_dict, answer) + self.emit_completion(1) self.submission_status = SubmissionStatus.SUBMITTED.value From b079ffaffa2ab2f2fbfeba97fc95e439e19bd0b4 Mon Sep 17 00:00:00 2001 From: Maria Grimaldi Date: Thu, 5 Oct 2023 09:20:33 -0400 Subject: [PATCH 08/15] refactor: fix tests after refactoring --- mindmap/tests/test_mindmap.py | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/mindmap/tests/test_mindmap.py b/mindmap/tests/test_mindmap.py index 3359ac2..e9cb556 100644 --- a/mindmap/tests/test_mindmap.py +++ b/mindmap/tests/test_mindmap.py @@ -35,12 +35,12 @@ def setUp(self) -> None: self.xblock.submit_allowed = Mock(return_value=True) self.xblock.past_due = Mock(return_value=False) self.xblock.get_raw_score = Mock(return_value=50) - self.xblock.get_weighted_score = Mock(return_value=0.50) + self.xblock.get_weighted_score = Mock(return_value=5) self.xblock.get_current_user = Mock(return_value=self.student) self.xblock.show_staff_grading_interface = Mock(return_value=False) self.xblock.display_name = "Test MindMap" self.xblock.points = 100 - self.xblock.weight = 1 + self.xblock.weight = 10 self.xblock.has_score = True self.xblock.submission_status = "Not attempted" self.xblock.course_id = "test-course-id" @@ -80,6 +80,7 @@ def test_student_view_with_mind_map(self, initialize_js_mock: Mock): "submission_status": self.xblock.submission_status, "raw_score": 50, "max_raw_score": self.xblock.points, + "weight": self.xblock.weight, } expected_js_context = { "author": self.student.full_name, @@ -87,6 +88,7 @@ def test_student_view_with_mind_map(self, initialize_js_mock: Mock): "editable": self.editable_mind_map, "xblock_id": self.xblock.scope_ids.usage_id.block_id, "max_raw_score": self.xblock.points, + "weight": self.xblock.weight, } self.xblock.student_view() @@ -124,6 +126,7 @@ def test_student_view_empty_mind_map(self, initialize_js_mock: Mock): "submission_status": self.xblock.submission_status, "raw_score": 50, "max_raw_score": self.xblock.points, + "weight": self.xblock.weight, } expected_js_context = { "author": self.student.full_name, @@ -131,6 +134,7 @@ def test_student_view_empty_mind_map(self, initialize_js_mock: Mock): "editable": self.editable_mind_map, "xblock_id": self.xblock.scope_ids.usage_id.block_id, "max_raw_score": self.xblock.points, + "weight": self.xblock.weight, } self.xblock.student_view() @@ -168,6 +172,7 @@ def test_static_mind_map_in_student_view(self): "submission_status": self.xblock.submission_status, "raw_score": 50, "max_raw_score": self.xblock.points, + "weight": self.xblock.weight, } self.xblock.student_view() @@ -204,6 +209,7 @@ def test_student_view_for_instructor(self): "submission_status": self.xblock.submission_status, "raw_score": 50, "max_raw_score": self.xblock.points, + "weight": self.xblock.weight, } self.xblock.student_view() @@ -224,7 +230,7 @@ def test_studio_view(self): "display_name": "Test Mind Map", "is_static": True, "points": 100, - "weight": 1, + "weight": 10, "has_score": True, } expected_context = { @@ -237,7 +243,7 @@ def test_studio_view(self): "can_submit_assignment": True, "points": 100, "points_field": self.xblock.fields["points"], - "weight": 1, + "weight": 10, "weight_field": self.xblock.fields["weight"], "has_score": True, "has_score_field": self.xblock.fields["has_score"], @@ -273,11 +279,12 @@ def test_author_view(self): "is_static": self.xblock.is_static, "is_static_field": self.xblock.fields["is_static"], "can_submit_assignment": True, - "score": 0, - "max_score": self.xblock.max_score(), + "raw_score": 50, + "max_raw_score": self.xblock.points, "has_score": True, "has_score_field": self.xblock.fields["has_score"], "submission_status": self.xblock.submission_status, + "weight": self.xblock.weight, } self.xblock.author_view() @@ -321,6 +328,7 @@ def test_student_not_allowed_submission(self, initialize_js_mock: Mock): "submission_status": self.xblock.submission_status, "raw_score": 50, "max_raw_score": self.xblock.points, + "weight": self.xblock.weight, } expected_js_context = { "author": self.student.full_name, @@ -328,6 +336,7 @@ def test_student_not_allowed_submission(self, initialize_js_mock: Mock): "editable": False, "xblock_id": block_id, "max_raw_score": self.xblock.points, + "weight": self.xblock.weight, } self.xblock.student_view() @@ -355,7 +364,7 @@ def setUp(self) -> None: "mind_map": self.mind_map, "is_static": True, "points": 100, - "weight": 1, + "weight": 10, } self.request = Mock( body=json.dumps(self.data).encode("utf-8"), @@ -364,7 +373,7 @@ def setUp(self) -> None: ) self.student_id = "test-student-id" self.raw_grade = 50 - self.weighted_grade = 1 + self.weighted_grade = 5 self.submission_id = "test-submission-id" def test_studio_submit(self): From 8d07b3a045dce1b92d7d21bdda68dcc94e3d7f86 Mon Sep 17 00:00:00 2001 From: Maria Grimaldi Date: Thu, 5 Oct 2023 09:21:47 -0400 Subject: [PATCH 09/15] fix: go back to previous context --- mindmap/mindmap.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mindmap/mindmap.py b/mindmap/mindmap.py index 9f43b73..bcb7052 100644 --- a/mindmap/mindmap.py +++ b/mindmap/mindmap.py @@ -315,6 +315,8 @@ def author_view(self, _context=None) -> Fragment: user = self.get_current_user() context = self.get_context() js_context = self.get_js_context(user, context) + context["editable"] = False + js_context["editable"] = False frag = self.load_fragment("mindmap", context) From d1b21bd29ee2ba0fe74f4b27fd3ed456cec9b7b4 Mon Sep 17 00:00:00 2001 From: Maria Grimaldi Date: Thu, 5 Oct 2023 09:35:03 -0400 Subject: [PATCH 10/15] refactor: fix tests after refactor --- mindmap/mindmap.py | 1 + mindmap/public/html/mindmap.html | 8 ++++---- mindmap/tests/test_mindmap.py | 7 +++++++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/mindmap/mindmap.py b/mindmap/mindmap.py index bcb7052..aebebca 100644 --- a/mindmap/mindmap.py +++ b/mindmap/mindmap.py @@ -251,6 +251,7 @@ def get_context(self, in_student_view=False): "raw_score": self.raw_score, "max_raw_score": self.points, "weight": self.weight, + "weighted_score": self.get_weighted_score(), }) return context diff --git a/mindmap/public/html/mindmap.html b/mindmap/public/html/mindmap.html index d8d2c43..fb619a6 100644 --- a/mindmap/public/html/mindmap.html +++ b/mindmap/public/html/mindmap.html @@ -53,10 +53,10 @@
-{% if not is_static and has_score and not raw_score and in_student_view %} -

(0/{{ max_raw_score }} {% trans "points" %}) {% trans submission_status %}

-{% elif not is_static and has_score and raw_score and in_student_view %} -

({{ raw_score }}/{{ max_raw_score }} {% trans "points" %}) {% trans submission_status %}

+{% if not is_static and has_score and not weighted_score and in_student_view %} +

(0/{{ weight }} {% trans "points" %}) {% trans submission_status %}

+{% elif not is_static and has_score and weighted_score and in_student_view %} +

({{ weighted_score }}/{{ weight }} {% trans "points" %}) {% trans submission_status %}

{% endif %} {% if editable and in_student_view and can_submit_assignment %} diff --git a/mindmap/tests/test_mindmap.py b/mindmap/tests/test_mindmap.py index e9cb556..910dcb6 100644 --- a/mindmap/tests/test_mindmap.py +++ b/mindmap/tests/test_mindmap.py @@ -81,6 +81,7 @@ def test_student_view_with_mind_map(self, initialize_js_mock: Mock): "raw_score": 50, "max_raw_score": self.xblock.points, "weight": self.xblock.weight, + "weighted_score": self.xblock.get_weighted_score(), } expected_js_context = { "author": self.student.full_name, @@ -127,6 +128,7 @@ def test_student_view_empty_mind_map(self, initialize_js_mock: Mock): "raw_score": 50, "max_raw_score": self.xblock.points, "weight": self.xblock.weight, + "weighted_score": self.xblock.get_weighted_score(), } expected_js_context = { "author": self.student.full_name, @@ -173,6 +175,7 @@ def test_static_mind_map_in_student_view(self): "raw_score": 50, "max_raw_score": self.xblock.points, "weight": self.xblock.weight, + "weighted_score": self.xblock.get_weighted_score(), } self.xblock.student_view() @@ -210,6 +213,7 @@ def test_student_view_for_instructor(self): "raw_score": 50, "max_raw_score": self.xblock.points, "weight": self.xblock.weight, + "weighted_score": self.xblock.get_weighted_score(), } self.xblock.student_view() @@ -250,6 +254,7 @@ def test_studio_view(self): "submission_status": self.xblock.submission_status, "raw_score": 50, "max_raw_score": self.xblock.points, + "weighted_score": self.xblock.get_weighted_score(), } self.xblock.studio_view() @@ -285,6 +290,7 @@ def test_author_view(self): "has_score_field": self.xblock.fields["has_score"], "submission_status": self.xblock.submission_status, "weight": self.xblock.weight, + "weighted_score": self.xblock.get_weighted_score(), } self.xblock.author_view() @@ -329,6 +335,7 @@ def test_student_not_allowed_submission(self, initialize_js_mock: Mock): "raw_score": 50, "max_raw_score": self.xblock.points, "weight": self.xblock.weight, + "weighted_score": self.xblock.get_weighted_score(), } expected_js_context = { "author": self.student.full_name, From cde613c2f85bd4f1b74b8e0e0623fc2e7371e9cd Mon Sep 17 00:00:00 2001 From: Maria Grimaldi Date: Thu, 5 Oct 2023 13:25:53 -0400 Subject: [PATCH 11/15] refactor: address PR reviews --- mindmap/mindmap.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/mindmap/mindmap.py b/mindmap/mindmap.py index aebebca..91d1a78 100644 --- a/mindmap/mindmap.py +++ b/mindmap/mindmap.py @@ -119,6 +119,13 @@ class MindMapXBlock(XBlock, CompletableXBlockMixin): scope=Scope.settings, ) + raw_score = Integer( + display_name=_("Raw score"), + help=_("The raw score for the assignment."), + default=None, + scope=Scope.user_state, + ) + points = Integer( display_name=_("Maximum score"), help=_("Maximum grade score given to assignment by staff."), @@ -132,6 +139,7 @@ class MindMapXBlock(XBlock, CompletableXBlockMixin): default=SubmissionStatus.NOT_ATTEMPTED.value, scope=Scope.user_state, ) + has_author_view = True @property @@ -267,6 +275,8 @@ def get_js_context(self, user, context): dict: The context for the student view """ return { + "raw_score": self.raw_score, + "weighted_score": self.get_weighted_score(), "author": user.full_name, "max_raw_score": self.points, "weight": self.weight, @@ -531,7 +541,7 @@ def get_student_data() -> dict: "timestamp": submission["created_at"].strftime( DateTime.DATETIME_FORMAT ), - "raw_score": raw_score, + "raw_score": state.get("raw_score", raw_score), "max_raw_score": self.points, "weight": self.weight, "weighted_score": self.get_weighted_score(student.student_id), @@ -557,7 +567,7 @@ def get_student_module(self, module_id): """ return StudentModule().objects.get(pk=module_id) - def update_student_state(self, module_id: int, submission_status: str) -> None: + def update_student_state(self, module_id: int, submission_status: str, raw_score: int=None) -> None: """ Updates the state of a student. @@ -568,6 +578,8 @@ def update_student_state(self, module_id: int, submission_status: str) -> None: module = self.get_student_module(module_id) state = json.loads(module.state) state["submission_status"] = submission_status + if not state.get("raw_score") and raw_score is not None: + state["raw_score"] = raw_score module.state = json.dumps(state) module.save() @@ -598,7 +610,7 @@ def enter_grade(self, data, _suffix="") -> dict: set_score(uuid, round((raw_score / self.points) * self.weight), self.weight) self.update_student_state( - data.get("module_id"), SubmissionStatus.COMPLETED.value + data.get("module_id"), SubmissionStatus.COMPLETED.value, raw_score=raw_score, ) return { From 7170cc7462a9dd42f8cb7c10b79075987eb45c3a Mon Sep 17 00:00:00 2001 From: Maria Grimaldi Date: Thu, 5 Oct 2023 13:41:18 -0400 Subject: [PATCH 12/15] fix: allow override raw score --- mindmap/mindmap.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mindmap/mindmap.py b/mindmap/mindmap.py index 91d1a78..7d03361 100644 --- a/mindmap/mindmap.py +++ b/mindmap/mindmap.py @@ -578,7 +578,7 @@ def update_student_state(self, module_id: int, submission_status: str, raw_score module = self.get_student_module(module_id) state = json.loads(module.state) state["submission_status"] = submission_status - if not state.get("raw_score") and raw_score is not None: + if raw_score is not None: state["raw_score"] = raw_score module.state = json.dumps(state) module.save() From fc01643282d5061dd2018b572f278f1d28e698ff Mon Sep 17 00:00:00 2001 From: Maria Grimaldi Date: Thu, 5 Oct 2023 13:59:20 -0400 Subject: [PATCH 13/15] refactor: allow 0 scores --- mindmap/mindmap.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mindmap/mindmap.py b/mindmap/mindmap.py index 7d03361..5a91644 100644 --- a/mindmap/mindmap.py +++ b/mindmap/mindmap.py @@ -600,9 +600,9 @@ def enter_grade(self, data, _suffix="") -> dict: require(self.is_course_team) - raw_score = int(data.get("grade")) + raw_score = int(data.get("grade", 0)) uuid = data.get("submission_id") - if not raw_score or not uuid: + if not uuid: raise JsonHandlerError(400, "Missing required parameters") if raw_score > self.points: raise JsonHandlerError(400, "Score cannot be greater than max score") From 3a0019f6c89873598eb10fc7c4dabfc8c45492c0 Mon Sep 17 00:00:00 2001 From: Bryann Valderrama Date: Thu, 5 Oct 2023 14:40:39 -0500 Subject: [PATCH 14/15] chore: update translations --- mindmap/locale/en/LC_MESSAGES/text.po | 58 ++++++++++------- mindmap/locale/es_419/LC_MESSAGES/text.mo | Bin 6113 -> 6306 bytes mindmap/locale/es_419/LC_MESSAGES/text.po | 60 +++++++++++------- mindmap/locale/es_ES/LC_MESSAGES/text.mo | Bin 6113 -> 6306 bytes mindmap/locale/es_ES/LC_MESSAGES/text.po | 60 +++++++++++------- mindmap/public/js/translations/es_419/text.js | 3 + mindmap/public/js/translations/es_ES/text.js | 3 + 7 files changed, 113 insertions(+), 71 deletions(-) diff --git a/mindmap/locale/en/LC_MESSAGES/text.po b/mindmap/locale/en/LC_MESSAGES/text.po index 45d8fc0..4629347 100644 --- a/mindmap/locale/en/LC_MESSAGES/text.po +++ b/mindmap/locale/en/LC_MESSAGES/text.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-09-25 11:10-0500\n" +"POT-Creation-Date: 2023-10-05 14:30-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Bryann Valderrama \n" "Language-Team: LANGUAGE \n" @@ -92,19 +92,27 @@ msgid "" "the problem is worth one point." msgstr "" -#: mindmap.py:123 public/html/mindmap_edit.html:32 -msgid "Maximum score" +#: mindmap.py:123 public/js/src/mindmap.js:88 +msgid "Raw score" msgstr "" #: mindmap.py:124 +msgid "The raw score for the assignment." +msgstr "" + +#: mindmap.py:130 public/html/mindmap_edit.html:32 +msgid "Maximum score" +msgstr "" + +#: mindmap.py:131 msgid "Maximum grade score given to assignment by staff." msgstr "" -#: mindmap.py:130 +#: mindmap.py:137 msgid "Submission status" msgstr "" -#: mindmap.py:131 +#: mindmap.py:138 msgid "The submission status of the assignment." msgstr "" @@ -196,51 +204,51 @@ msgstr "" msgid "Username" msgstr "" -#: public/js/src/mindmap.js:85 +#: public/js/src/mindmap.js:86 msgid "Uploaded" msgstr "" -#: public/js/src/mindmap.js:86 +#: public/js/src/mindmap.js:87 msgid "Submission Status" msgstr "" -#: public/js/src/mindmap.js:87 public/js/src/mindmap.js:171 -msgid "Grade" +#: public/js/src/mindmap.js:89 +msgid "Weighted score" msgstr "" -#: public/js/src/mindmap.js:88 +#: public/js/src/mindmap.js:90 msgid "Actions" msgstr "" -#: public/js/src/mindmap.js:108 +#: public/js/src/mindmap.js:110 msgid "Mindmap submissions" msgstr "" -#: public/js/src/mindmap.js:109 +#: public/js/src/mindmap.js:111 msgid "Review" msgstr "" -#: public/js/src/mindmap.js:110 +#: public/js/src/mindmap.js:112 msgid "Search" msgstr "" -#: public/js/src/mindmap.js:111 +#: public/js/src/mindmap.js:113 msgid "Showing _START_ to _END_ of _TOTAL_ entries" msgstr "" -#: public/js/src/mindmap.js:112 +#: public/js/src/mindmap.js:114 msgid "No data available in table" msgstr "" -#: public/js/src/mindmap.js:113 +#: public/js/src/mindmap.js:115 msgid "Showing 0 to 0 of 0 entries" msgstr "" -#: public/js/src/mindmap.js:114 +#: public/js/src/mindmap.js:116 msgid "No matching records found" msgstr "" -#: public/js/src/mindmap.js:115 +#: public/js/src/mindmap.js:117 msgid "(filtered from _MAX_ total entries)" msgstr "" @@ -248,22 +256,26 @@ msgstr "" msgid "Remove grade" msgstr "" -#: public/js/src/mindmap.js:168 +#: public/js/src/mindmap.js:187 msgid "Loading..." msgstr "" -#: public/js/src/mindmap.js:169 +#: public/js/src/mindmap.js:188 msgid "Back" msgstr "" -#: public/js/src/mindmap.js:191 +#: public/js/src/mindmap.js:189 +msgid "Grade" +msgstr "" + +#: public/js/src/mindmap.js:210 msgid "Reviewing Mindmap for student: " msgstr "" -#: public/js/src/mindmap.js:235 +#: public/js/src/mindmap.js:254 msgid "Invalid grade must be a number" msgstr "" -#: public/js/src/mindmap.js:236 +#: public/js/src/mindmap.js:255 msgid "Please enter a lower grade, maximum grade allowed is:" msgstr "" diff --git a/mindmap/locale/es_419/LC_MESSAGES/text.mo b/mindmap/locale/es_419/LC_MESSAGES/text.mo index 7e69a360bdfcb4a5981699fbcb507d8c687fa251..3d03b11cb59816bbc0aa1d2ae5356e0a44c2b239 100644 GIT binary patch delta 1519 zcmYk+NoW&M9LMq3n%LI1ni$vG>S*1Uw6!jAucFbmf{M7|LB@2d(U@qG;({fJJrs)c zPz3R!^dP7wiKqv~g9`2-9$XHEA|i??h@zmN-(NBTA9?xA^5!l7|C<@C>u<;mjP#r} zl$F$KYDKXzTk+2j{wN!~#?)dnmf#`uU9;EAa-F;(b)RXQ+C)s0sIA z1>>8u9Pq5^$4Ph@wZca@0-wA02XF%C?{N+mF&nLDp6e=9KU+`(?8I}p7x&(VOfUd*o5nGHg@AQ z%wi3`LACpd8LhaHIMw4;+{Hj$s1**-yCyb_Flc}P>bwe-qFOwHLGDze4oUy)bHIelu00R$Pw?)naVL6w=h(b$x+q_YT$J zCp?eeP^mq`&eQ}eS-x`Lh-A@hLp`@A!+|<%M{T-e?s+FBNJTHc=K9~!`CPwd`dZ-! zR0rQNjK6Umt{H1g9d@H4bqlB9Ag)HwIAf+_7#CsYAP0sBlS)5F#sx!vO z70XpQ)Fia2RP_2OZAvAd5wn!4=&3BHvKAAhYTy}EhUWd}K%uLrDu>!wg`%8k_F8eF zC|Zh?!a2dc*ogWDsOY<;kD1DXJh^{uOtO*-zuua8)Ujq${_D1a6TJy4+W88R^0tJk zvY6VCJIepD?{Yg?n^JEC*~yilWi$^QdE;HoLcRPq?O+9SavEE z-4{RP#M8k(Us-dd6WzBz?X_*whr4#+ltv%+D?!CmO4RYY0R16l}?5N@J%k;}fnJ2z<2AOG{2|DAjPk8{rTe(GD&S*j1- zHrgTjX8O+xvtzihiVs>Msmh@BY1EJm;oFJKzN zvLll9ZI~~bU<8K13Fs~Nj+3!XyVcNKNO zIqbkiJkB~1!sE1Z;Vf~{jwVqHO!?y(R4N|f7`nI?n+XqDvkWT4J*bW5P$@ZyZ8(PH z*zWnizd-hCAFvC*)DeHaTZ~!tLjsk%4phi;{`eB=WD}?&b&*5ZM;yVgs0}3fSdV>3 zR;+-E%xQmo163;})IlFciN8YhgbR86f&5vfzU(mS#uKOs&)_tkN2M;vY}>JjWX&F+ z?tg}wXBL(7dAvx--{T_V!|Tc^jXP{tCuu=Fn8qQ@;vkM=5?`Yt@*8(xQ=C&`KPK=R zX7Dkxju+l6YIAA2nhv0**I7|fb5z-lbe{8?cCF&kWLj8t@xP`tD0OPewO%o8a6g^k zc#T7P>F7qKRc%ihJAfR-@d~8Lzo;Dl+X4&}9irwHnnJ87DWodg6kYGU+Clm*`aZgf zQ>~q@|6?t5rCBwmH-S3#3N`Wf2-J`FYE-*}l}7{ao$!1`X*@FEevW((yKkfYfl@k_ Jb0=dB!9RKYXuSXc diff --git a/mindmap/locale/es_419/LC_MESSAGES/text.po b/mindmap/locale/es_419/LC_MESSAGES/text.po index 3e80efd..2a9483c 100644 --- a/mindmap/locale/es_419/LC_MESSAGES/text.po +++ b/mindmap/locale/es_419/LC_MESSAGES/text.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-09-25 11:10-0500\n" +"POT-Creation-Date: 2023-10-05 14:30-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Bryann Valderrama \n" "Language-Team: LANGUAGE \n" @@ -106,19 +106,27 @@ msgstr "" "Define la cantidad de puntos que vale este problema. Si el valor no está " "establecido, el problema vale un punto." -#: mindmap.py:123 public/html/mindmap_edit.html:32 +#: mindmap.py:123 public/js/src/mindmap.js:88 +msgid "Raw score" +msgstr "Puntaje bruto" + +#: mindmap.py:124 +msgid "The raw score for the assignment." +msgstr "La calificación bruta para la tarea." + +#: mindmap.py:130 public/html/mindmap_edit.html:32 msgid "Maximum score" msgstr "Puntaje máximo" -#: mindmap.py:124 +#: mindmap.py:131 msgid "Maximum grade score given to assignment by staff." msgstr "Calificación máxima dada a la tarea por el instructor." -#: mindmap.py:130 +#: mindmap.py:137 msgid "Submission status" msgstr "Estado del envío" -#: mindmap.py:131 +#: mindmap.py:138 msgid "The submission status of the assignment." msgstr "El estado del envío de la tarea." @@ -210,51 +218,51 @@ msgstr "Cancelar" msgid "Username" msgstr "Nombre de usuario" -#: public/js/src/mindmap.js:85 +#: public/js/src/mindmap.js:86 msgid "Uploaded" msgstr "Subido" -#: public/js/src/mindmap.js:86 +#: public/js/src/mindmap.js:87 msgid "Submission Status" msgstr "Estado del Envío" -#: public/js/src/mindmap.js:87 public/js/src/mindmap.js:171 -msgid "Grade" -msgstr "Calificación" +#: public/js/src/mindmap.js:89 +msgid "Weighted score" +msgstr "Puntaje ponderado" -#: public/js/src/mindmap.js:88 +#: public/js/src/mindmap.js:90 msgid "Actions" msgstr "Acciones" -#: public/js/src/mindmap.js:108 +#: public/js/src/mindmap.js:1010 msgid "Mindmap submissions" msgstr "Envíos de mapas mentales" -#: public/js/src/mindmap.js:109 +#: public/js/src/mindmap.js:111 msgid "Review" msgstr "Revisar" -#: public/js/src/mindmap.js:110 +#: public/js/src/mindmap.js:112 msgid "Search" msgstr "Buscar" -#: public/js/src/mindmap.js:111 +#: public/js/src/mindmap.js:113 msgid "Showing _START_ to _END_ of _TOTAL_ entries" msgstr "Mostrando registros del _START_ al _END_ de un total de _TOTAL_ registro(s)" -#: public/js/src/mindmap.js:112 +#: public/js/src/mindmap.js:114 msgid "No data available in table" msgstr "Ningún dato disponible en esta tabla" -#: public/js/src/mindmap.js:113 +#: public/js/src/mindmap.js:115 msgid "Showing 0 to 0 of 0 entries" msgstr "Mostrando registros del 0 al 0 de un total de 0 registro(s)" -#: public/js/src/mindmap.js:114 +#: public/js/src/mindmap.js:116 msgid "No matching records found" msgstr "No se encontraron resultados" -#: public/js/src/mindmap.js:115 +#: public/js/src/mindmap.js:117 msgid "(filtered from _MAX_ total entries)" msgstr "(filtrado de un total de _MAX_ registro(s))" @@ -262,22 +270,26 @@ msgstr "(filtrado de un total de _MAX_ registro(s))" msgid "Remove grade" msgstr "Eliminar calificación" -#: public/js/src/mindmap.js:168 +#: public/js/src/mindmap.js:187 msgid "Loading..." msgstr "Cargando..." -#: public/js/src/mindmap.js:169 +#: public/js/src/mindmap.js:188 msgid "Back" msgstr "Volver" -#: public/js/src/mindmap.js:191 +#: public/js/src/mindmap.js:189 +msgid "Grade" +msgstr "Calificación" + +#: public/js/src/mindmap.js:210 msgid "Reviewing Mindmap for student: " msgstr "Revisando Mapa Mental para el estudiante: " -#: public/js/src/mindmap.js:235 +#: public/js/src/mindmap.js:254 msgid "Invalid grade must be a number" msgstr "Calificación inválida, debe ser un número" -#: public/js/src/mindmap.js:236 +#: public/js/src/mindmap.js:255 msgid "Please enter a lower grade, maximum grade allowed is:" msgstr "Por favor ingresa una calificación menor, la calificación máxima permitida es:" diff --git a/mindmap/locale/es_ES/LC_MESSAGES/text.mo b/mindmap/locale/es_ES/LC_MESSAGES/text.mo index 7e69a360bdfcb4a5981699fbcb507d8c687fa251..3d03b11cb59816bbc0aa1d2ae5356e0a44c2b239 100644 GIT binary patch delta 1519 zcmYk+NoW&M9LMq3n%LI1ni$vG>S*1Uw6!jAucFbmf{M7|LB@2d(U@qG;({fJJrs)c zPz3R!^dP7wiKqv~g9`2-9$XHEA|i??h@zmN-(NBTA9?xA^5!l7|C<@C>u<;mjP#r} zl$F$KYDKXzTk+2j{wN!~#?)dnmf#`uU9;EAa-F;(b)RXQ+C)s0sIA z1>>8u9Pq5^$4Ph@wZca@0-wA02XF%C?{N+mF&nLDp6e=9KU+`(?8I}p7x&(VOfUd*o5nGHg@AQ z%wi3`LACpd8LhaHIMw4;+{Hj$s1**-yCyb_Flc}P>bwe-qFOwHLGDze4oUy)bHIelu00R$Pw?)naVL6w=h(b$x+q_YT$J zCp?eeP^mq`&eQ}eS-x`Lh-A@hLp`@A!+|<%M{T-e?s+FBNJTHc=K9~!`CPwd`dZ-! zR0rQNjK6Umt{H1g9d@H4bqlB9Ag)HwIAf+_7#CsYAP0sBlS)5F#sx!vO z70XpQ)Fia2RP_2OZAvAd5wn!4=&3BHvKAAhYTy}EhUWd}K%uLrDu>!wg`%8k_F8eF zC|Zh?!a2dc*ogWDsOY<;kD1DXJh^{uOtO*-zuua8)Ujq${_D1a6TJy4+W88R^0tJk zvY6VCJIepD?{Yg?n^JEC*~yilWi$^QdE;HoLcRPq?O+9SavEE z-4{RP#M8k(Us-dd6WzBz?X_*whr4#+ltv%+D?!CmO4RYY0R16l}?5N@J%k;}fnJ2z<2AOG{2|DAjPk8{rTe(GD&S*j1- zHrgTjX8O+xvtzihiVs>Msmh@BY1EJm;oFJKzN zvLll9ZI~~bU<8K13Fs~Nj+3!XyVcNKNO zIqbkiJkB~1!sE1Z;Vf~{jwVqHO!?y(R4N|f7`nI?n+XqDvkWT4J*bW5P$@ZyZ8(PH z*zWnizd-hCAFvC*)DeHaTZ~!tLjsk%4phi;{`eB=WD}?&b&*5ZM;yVgs0}3fSdV>3 zR;+-E%xQmo163;})IlFciN8YhgbR86f&5vfzU(mS#uKOs&)_tkN2M;vY}>JjWX&F+ z?tg}wXBL(7dAvx--{T_V!|Tc^jXP{tCuu=Fn8qQ@;vkM=5?`Yt@*8(xQ=C&`KPK=R zX7Dkxju+l6YIAA2nhv0**I7|fb5z-lbe{8?cCF&kWLj8t@xP`tD0OPewO%o8a6g^k zc#T7P>F7qKRc%ihJAfR-@d~8Lzo;Dl+X4&}9irwHnnJ87DWodg6kYGU+Clm*`aZgf zQ>~q@|6?t5rCBwmH-S3#3N`Wf2-J`FYE-*}l}7{ao$!1`X*@FEevW((yKkfYfl@k_ Jb0=dB!9RKYXuSXc diff --git a/mindmap/locale/es_ES/LC_MESSAGES/text.po b/mindmap/locale/es_ES/LC_MESSAGES/text.po index 3e80efd..2a9483c 100644 --- a/mindmap/locale/es_ES/LC_MESSAGES/text.po +++ b/mindmap/locale/es_ES/LC_MESSAGES/text.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-09-25 11:10-0500\n" +"POT-Creation-Date: 2023-10-05 14:30-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Bryann Valderrama \n" "Language-Team: LANGUAGE \n" @@ -106,19 +106,27 @@ msgstr "" "Define la cantidad de puntos que vale este problema. Si el valor no está " "establecido, el problema vale un punto." -#: mindmap.py:123 public/html/mindmap_edit.html:32 +#: mindmap.py:123 public/js/src/mindmap.js:88 +msgid "Raw score" +msgstr "Puntaje bruto" + +#: mindmap.py:124 +msgid "The raw score for the assignment." +msgstr "La calificación bruta para la tarea." + +#: mindmap.py:130 public/html/mindmap_edit.html:32 msgid "Maximum score" msgstr "Puntaje máximo" -#: mindmap.py:124 +#: mindmap.py:131 msgid "Maximum grade score given to assignment by staff." msgstr "Calificación máxima dada a la tarea por el instructor." -#: mindmap.py:130 +#: mindmap.py:137 msgid "Submission status" msgstr "Estado del envío" -#: mindmap.py:131 +#: mindmap.py:138 msgid "The submission status of the assignment." msgstr "El estado del envío de la tarea." @@ -210,51 +218,51 @@ msgstr "Cancelar" msgid "Username" msgstr "Nombre de usuario" -#: public/js/src/mindmap.js:85 +#: public/js/src/mindmap.js:86 msgid "Uploaded" msgstr "Subido" -#: public/js/src/mindmap.js:86 +#: public/js/src/mindmap.js:87 msgid "Submission Status" msgstr "Estado del Envío" -#: public/js/src/mindmap.js:87 public/js/src/mindmap.js:171 -msgid "Grade" -msgstr "Calificación" +#: public/js/src/mindmap.js:89 +msgid "Weighted score" +msgstr "Puntaje ponderado" -#: public/js/src/mindmap.js:88 +#: public/js/src/mindmap.js:90 msgid "Actions" msgstr "Acciones" -#: public/js/src/mindmap.js:108 +#: public/js/src/mindmap.js:1010 msgid "Mindmap submissions" msgstr "Envíos de mapas mentales" -#: public/js/src/mindmap.js:109 +#: public/js/src/mindmap.js:111 msgid "Review" msgstr "Revisar" -#: public/js/src/mindmap.js:110 +#: public/js/src/mindmap.js:112 msgid "Search" msgstr "Buscar" -#: public/js/src/mindmap.js:111 +#: public/js/src/mindmap.js:113 msgid "Showing _START_ to _END_ of _TOTAL_ entries" msgstr "Mostrando registros del _START_ al _END_ de un total de _TOTAL_ registro(s)" -#: public/js/src/mindmap.js:112 +#: public/js/src/mindmap.js:114 msgid "No data available in table" msgstr "Ningún dato disponible en esta tabla" -#: public/js/src/mindmap.js:113 +#: public/js/src/mindmap.js:115 msgid "Showing 0 to 0 of 0 entries" msgstr "Mostrando registros del 0 al 0 de un total de 0 registro(s)" -#: public/js/src/mindmap.js:114 +#: public/js/src/mindmap.js:116 msgid "No matching records found" msgstr "No se encontraron resultados" -#: public/js/src/mindmap.js:115 +#: public/js/src/mindmap.js:117 msgid "(filtered from _MAX_ total entries)" msgstr "(filtrado de un total de _MAX_ registro(s))" @@ -262,22 +270,26 @@ msgstr "(filtrado de un total de _MAX_ registro(s))" msgid "Remove grade" msgstr "Eliminar calificación" -#: public/js/src/mindmap.js:168 +#: public/js/src/mindmap.js:187 msgid "Loading..." msgstr "Cargando..." -#: public/js/src/mindmap.js:169 +#: public/js/src/mindmap.js:188 msgid "Back" msgstr "Volver" -#: public/js/src/mindmap.js:191 +#: public/js/src/mindmap.js:189 +msgid "Grade" +msgstr "Calificación" + +#: public/js/src/mindmap.js:210 msgid "Reviewing Mindmap for student: " msgstr "Revisando Mapa Mental para el estudiante: " -#: public/js/src/mindmap.js:235 +#: public/js/src/mindmap.js:254 msgid "Invalid grade must be a number" msgstr "Calificación inválida, debe ser un número" -#: public/js/src/mindmap.js:236 +#: public/js/src/mindmap.js:255 msgid "Please enter a lower grade, maximum grade allowed is:" msgstr "Por favor ingresa una calificación menor, la calificación máxima permitida es:" diff --git a/mindmap/public/js/translations/es_419/text.js b/mindmap/public/js/translations/es_419/text.js index 73687b4..d189cf1 100644 --- a/mindmap/public/js/translations/es_419/text.js +++ b/mindmap/public/js/translations/es_419/text.js @@ -51,6 +51,7 @@ "Not attempted": "No intentado", "Please enter a lower grade, maximum grade allowed is:": "Por favor ingresa una calificaci\u00f3n menor, la calificaci\u00f3n m\u00e1xima permitida es:", "Problem Weight": "Peso del problema", + "Raw score": "Puntaje bruto", "Remove grade": "Eliminar calificaci\u00f3n", "Review": "Revisar", "Reviewing Mindmap for student: ": "Revisando Mapa Mental para el estudiante: ", @@ -65,11 +66,13 @@ "Submitted": "Enviado", "The body of the mind map. It is a dictionary with the following structure: {'root': {'text': 'Root', 'children': [{'text': 'Child 1', 'children': []}]}}": "El contenido del mapa mental. Es un diccionario con la siguiente estructura: {'root': {'text': 'Root', 'children': [{'text': 'Child 1', 'children': []}]}}", "The mind map that will be shown to students if the\"Is a static mindmap?\" field is set to \"True\"": "El mapa mental que se mostrar\u00e1 a los estudiantes si el campo \"\u00bfEs un mapa mental est\u00e1tico?\" est\u00e1 establecido en \"Verdadero\"", + "The raw score for the assignment.": "La calificaci\u00f3n bruta para la tarea.", "The submission status of the assignment.": "El estado del env\u00edo de la tarea.", "True": "Verdadero", "Uploaded": "Subido", "Username": "Nombre de usuario", "Weight": "Peso", + "Weighted score": "Puntaje ponderado", "Whether the component is scorable. If is scorable, the student can submit the mind map and receive a score from the instructor. If it is not scorable, the student only can save the mind map. WARNING: Changing from scorable to not scorable, the progress of the students who have already been assigned a grade will not be reset.": "Si el componente es calificable. Si es calificable, el estudiante puede enviar el mapa mental y recibir una calificaci\u00f3n del instructor. Si no es calificable, el estudiante solo puede guardar el mapa mental. ADVERTENCIA: Si cambia de calificable a no calificable, no se restablecer\u00e1 el progreso de los estudiantes a los que ya se les haya asignado una calificaci\u00f3n", "Whether the mind map is static or not. If it is static, the instructor can create a mind map and it will be the same for all students. If it is not static, the students can create their own mind maps.": "Si el mapa mental es est\u00e1tico o no. Si es est\u00e1tico, el instructor puede crear un mapa mental y ser\u00e1 el mismo para todos los estudiantes. Si no es est\u00e1tico, los estudiantes pueden crear sus propios mapas mentales.", "With the keyboard": "Con el teclado", diff --git a/mindmap/public/js/translations/es_ES/text.js b/mindmap/public/js/translations/es_ES/text.js index 73687b4..d189cf1 100644 --- a/mindmap/public/js/translations/es_ES/text.js +++ b/mindmap/public/js/translations/es_ES/text.js @@ -51,6 +51,7 @@ "Not attempted": "No intentado", "Please enter a lower grade, maximum grade allowed is:": "Por favor ingresa una calificaci\u00f3n menor, la calificaci\u00f3n m\u00e1xima permitida es:", "Problem Weight": "Peso del problema", + "Raw score": "Puntaje bruto", "Remove grade": "Eliminar calificaci\u00f3n", "Review": "Revisar", "Reviewing Mindmap for student: ": "Revisando Mapa Mental para el estudiante: ", @@ -65,11 +66,13 @@ "Submitted": "Enviado", "The body of the mind map. It is a dictionary with the following structure: {'root': {'text': 'Root', 'children': [{'text': 'Child 1', 'children': []}]}}": "El contenido del mapa mental. Es un diccionario con la siguiente estructura: {'root': {'text': 'Root', 'children': [{'text': 'Child 1', 'children': []}]}}", "The mind map that will be shown to students if the\"Is a static mindmap?\" field is set to \"True\"": "El mapa mental que se mostrar\u00e1 a los estudiantes si el campo \"\u00bfEs un mapa mental est\u00e1tico?\" est\u00e1 establecido en \"Verdadero\"", + "The raw score for the assignment.": "La calificaci\u00f3n bruta para la tarea.", "The submission status of the assignment.": "El estado del env\u00edo de la tarea.", "True": "Verdadero", "Uploaded": "Subido", "Username": "Nombre de usuario", "Weight": "Peso", + "Weighted score": "Puntaje ponderado", "Whether the component is scorable. If is scorable, the student can submit the mind map and receive a score from the instructor. If it is not scorable, the student only can save the mind map. WARNING: Changing from scorable to not scorable, the progress of the students who have already been assigned a grade will not be reset.": "Si el componente es calificable. Si es calificable, el estudiante puede enviar el mapa mental y recibir una calificaci\u00f3n del instructor. Si no es calificable, el estudiante solo puede guardar el mapa mental. ADVERTENCIA: Si cambia de calificable a no calificable, no se restablecer\u00e1 el progreso de los estudiantes a los que ya se les haya asignado una calificaci\u00f3n", "Whether the mind map is static or not. If it is static, the instructor can create a mind map and it will be the same for all students. If it is not static, the students can create their own mind maps.": "Si el mapa mental es est\u00e1tico o no. Si es est\u00e1tico, el instructor puede crear un mapa mental y ser\u00e1 el mismo para todos los estudiantes. Si no es est\u00e1tico, los estudiantes pueden crear sus propios mapas mentales.", "With the keyboard": "Con el teclado", From 6f8038182d901d15d08f807b6170e9ae90935026 Mon Sep 17 00:00:00 2001 From: Maria Grimaldi Date: Thu, 5 Oct 2023 16:42:42 -0400 Subject: [PATCH 15/15] fix: remove raw_score as property --- mindmap/mindmap.py | 7 ------- mindmap/tests/test_mindmap.py | 7 +++++++ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/mindmap/mindmap.py b/mindmap/mindmap.py index 5a91644..ced85a9 100644 --- a/mindmap/mindmap.py +++ b/mindmap/mindmap.py @@ -156,13 +156,6 @@ def block_course_id(self): """ return str(self.course_id) - @property - def raw_score(self): - """ - Return score from submissions. - """ - return self.get_raw_score() - def get_weighted_score(self, student_id=None): """ Return weighted score from submissions. diff --git a/mindmap/tests/test_mindmap.py b/mindmap/tests/test_mindmap.py index 910dcb6..3e0b867 100644 --- a/mindmap/tests/test_mindmap.py +++ b/mindmap/tests/test_mindmap.py @@ -42,6 +42,7 @@ def setUp(self) -> None: self.xblock.points = 100 self.xblock.weight = 10 self.xblock.has_score = True + self.xblock.raw_score = 50 self.xblock.submission_status = "Not attempted" self.xblock.course_id = "test-course-id" @@ -90,6 +91,8 @@ def test_student_view_with_mind_map(self, initialize_js_mock: Mock): "xblock_id": self.xblock.scope_ids.usage_id.block_id, "max_raw_score": self.xblock.points, "weight": self.xblock.weight, + "weighted_score": self.xblock.get_weighted_score(), + "raw_score": self.xblock.raw_score, } self.xblock.student_view() @@ -137,6 +140,8 @@ def test_student_view_empty_mind_map(self, initialize_js_mock: Mock): "xblock_id": self.xblock.scope_ids.usage_id.block_id, "max_raw_score": self.xblock.points, "weight": self.xblock.weight, + "weighted_score": self.xblock.get_weighted_score(), + "raw_score": self.xblock.raw_score, } self.xblock.student_view() @@ -344,6 +349,8 @@ def test_student_not_allowed_submission(self, initialize_js_mock: Mock): "xblock_id": block_id, "max_raw_score": self.xblock.points, "weight": self.xblock.weight, + "weighted_score": self.xblock.get_weighted_score(), + "raw_score": self.xblock.raw_score, } self.xblock.student_view()