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 7e69a36..3d03b11 100644 Binary files a/mindmap/locale/es_419/LC_MESSAGES/text.mo and b/mindmap/locale/es_419/LC_MESSAGES/text.mo differ 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 7e69a36..3d03b11 100644 Binary files a/mindmap/locale/es_ES/LC_MESSAGES/text.mo and b/mindmap/locale/es_ES/LC_MESSAGES/text.mo differ 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/mindmap.py b/mindmap/mindmap.py index e0fc742..ced85a9 100644 --- a/mindmap/mindmap.py +++ b/mindmap/mindmap.py @@ -13,7 +13,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 ( @@ -109,16 +109,23 @@ 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=10, 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 @@ -148,18 +156,24 @@ def block_course_id(self): """ return str(self.course_id) - @property - def score(self): + def get_weighted_score(self, student_id=None): """ - Return score from submissions. + Return weighted score from submissions. """ - return self.get_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"] + + return None def max_score(self): """ Return the maximum score. """ - return self.points + return self.weight def get_current_user(self): """ @@ -235,8 +249,10 @@ 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, + "weight": self.weight, + "weighted_score": self.get_weighted_score(), }) return context @@ -252,8 +268,11 @@ 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_points": self.points, + "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, @@ -435,6 +454,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 @@ -500,7 +520,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 @@ -514,13 +534,17 @@ def get_student_data() -> dict: "timestamp": submission["created_at"].strftime( DateTime.DATETIME_FORMAT ), - "score": 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), "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, } @@ -536,7 +560,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. @@ -547,6 +571,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 raw_score is not None: + state["raw_score"] = raw_score module.state = json.dumps(state) module.save() @@ -567,17 +593,17 @@ def enter_grade(self, data, _suffix="") -> dict: require(self.is_course_team) - score = int(data.get("grade")) + raw_score = int(data.get("grade", 0)) uuid = data.get("submission_id") - if not score or not uuid: + if 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, 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 { @@ -634,7 +660,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: @@ -655,11 +681,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. @@ -669,12 +695,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 round((weighted_score * self.points) / self.weight) return None diff --git a/mindmap/public/html/mindmap.html b/mindmap/public/html/mindmap.html index fdb00f8..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 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 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/public/js/src/mindmap.js b/mindmap/public/js/src/mindmap.js index 705806b..e57ce31 100644 --- a/mindmap/public/js/src/mindmap.js +++ b/mindmap/public/js/src/mindmap.js @@ -5,7 +5,8 @@ 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; + const problemWeight = context.weight; let gettext; if ("MindMapI18N" in window || "gettext" in window) { @@ -84,7 +85,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 +133,24 @@ function MindMapXBlock(runtime, element, context) { return gettext(data); }, }, - { data: "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: () => { 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", diff --git a/mindmap/tests/test_mindmap.py b/mindmap/tests/test_mindmap.py index 21e4c2d..3e0b867 100644 --- a/mindmap/tests/test_mindmap.py +++ b/mindmap/tests/test_mindmap.py @@ -34,13 +34,15 @@ 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=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.raw_score = 50 self.xblock.submission_status = "Not attempted" self.xblock.course_id = "test-course-id" @@ -74,18 +76,23 @@ 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, + "weight": self.xblock.weight, + "weighted_score": self.xblock.get_weighted_score(), } expected_js_context = { "author": self.student.full_name, "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, + "weight": self.xblock.weight, + "weighted_score": self.xblock.get_weighted_score(), + "raw_score": self.xblock.raw_score, } self.xblock.student_view() @@ -118,18 +125,23 @@ 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, + "weight": self.xblock.weight, + "weighted_score": self.xblock.get_weighted_score(), } expected_js_context = { "author": self.student.full_name, "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, + "weight": self.xblock.weight, + "weighted_score": self.xblock.get_weighted_score(), + "raw_score": self.xblock.raw_score, } self.xblock.student_view() @@ -162,11 +174,13 @@ 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, + "weight": self.xblock.weight, + "weighted_score": self.xblock.get_weighted_score(), } self.xblock.student_view() @@ -197,12 +211,14 @@ 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, + "weight": self.xblock.weight, + "weighted_score": self.xblock.get_weighted_score(), } self.xblock.student_view() @@ -223,7 +239,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 = { @@ -234,15 +250,16 @@ 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": 10, "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, + "weighted_score": self.xblock.get_weighted_score(), } self.xblock.studio_view() @@ -272,11 +289,13 @@ 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, + "weighted_score": self.xblock.get_weighted_score(), } self.xblock.author_view() @@ -315,18 +334,23 @@ 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, + "weight": self.xblock.weight, + "weighted_score": self.xblock.get_weighted_score(), } expected_js_context = { "author": self.student.full_name, "mind_map": self.mind_map, "editable": False, "xblock_id": block_id, - "max_points": self.xblock.points, + "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() @@ -354,7 +378,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"), @@ -362,7 +386,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 = 5 self.submission_id = "test-submission-id" def test_studio_submit(self): @@ -455,7 +480,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 +494,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 +537,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 +568,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,