Skip to content

Commit

Permalink
refactor: fix tests after refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
mariajgrimaldi committed Oct 5, 2023
1 parent 8d07b3a commit d1b21bd
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions mindmap/mindmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions mindmap/public/html/mindmap.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@

<div id="jsmind_container_{{xblock_id}}" class="jsmind_container"></div>

{% if not is_static and has_score and not raw_score and in_student_view %}
<p>(0/{{ max_raw_score }} {% trans "points" %}) {% trans submission_status %}</p>
{% elif not is_static and has_score and raw_score and in_student_view %}
<p>({{ raw_score }}/{{ max_raw_score }} {% trans "points" %}) {% trans submission_status %}</p>
{% if not is_static and has_score and not weighted_score and in_student_view %}
<p>(0/{{ weight }} {% trans "points" %}) {% trans submission_status %}</p>
{% elif not is_static and has_score and weighted_score and in_student_view %}
<p>({{ weighted_score }}/{{ weight }} {% trans "points" %}) {% trans submission_status %}</p>
{% endif %}

{% if editable and in_student_view and can_submit_assignment %}
Expand Down
7 changes: 7 additions & 0 deletions mindmap/tests/test_mindmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit d1b21bd

Please sign in to comment.