Commit c111e009 by muzaffaryousaf

Fixing the bugs and UI/texts.

TNL-1354
parent 26025e0c
......@@ -985,8 +985,9 @@ def on_cancel(submission_uuid):
"""
try:
workflow = PeerWorkflow.get_by_submission_uuid(submission_uuid)
workflow.cancelled_at = timezone.now()
workflow.save()
if workflow:
workflow.cancelled_at = timezone.now()
workflow.save()
except (PeerAssessmentWorkflowError, DatabaseError):
error_message = (
u"An internal error occurred while cancelling the peer"
......
......@@ -965,6 +965,18 @@ class TestPeerApi(CacheResetTest):
workflow = PeerWorkflow.get_by_submission_uuid(buffy_sub["uuid"])
self.assertTrue(workflow.is_cancelled)
def test_cancel_submission_when_peerworkflow_does_not_exist(self):
new_student_item = STUDENT_ITEM.copy()
new_student_item["student_id"] = "Buffy"
submission = sub_api.create_submission(new_student_item, "Buffy Answer")
peer_api.on_cancel(submission['uuid'])
# Check for a workflow for Buffy.
# It should be None
buffy_workflow = PeerWorkflow.get_by_submission_uuid(submission['uuid'])
self.assertIsNone(buffy_workflow)
def test_get_workflow_by_uuid(self):
buffy_answer, _ = self._create_student_and_submission("Buffy", "Buffy's answer")
self._create_student_and_submission("Xander", "Xander's answer")
......
......@@ -7,11 +7,16 @@
<span class="step__label">{% trans "Your Grade" %}: </span>
<span class="grade__value">
<span class="grade__value__title">
{% with points_earned_string=score.points_earned|stringformat:"s" points_possible_string=score.points_possible|stringformat:"s" %}
{% blocktrans with points_earned='<span class="grade__value__earned">'|safe|add:points_earned_string|add:'</span>'|safe points_possible='<span class="grade__value__potential">'|safe|add:points_possible_string|add:'</span>'|safe %}
{{ points_earned }} out of {{ points_possible }}
{% endblocktrans %}
{% endwith %}
{% if score %}
{% with points_earned_string=score.points_earned|stringformat:"s" points_possible_string=score.points_possible|stringformat:"s" %}
{% blocktrans with points_earned='<span class="grade__value__earned">'|safe|add:points_earned_string|add:'</span>'|safe points_possible='<span class="grade__value__potential">'|safe|add:points_possible_string|add:'</span>'|safe %}
{{ points_earned }} out of {{ points_possible }}
{% endblocktrans %}
{% endwith %}
{% else %}
<!--When submission is cancelled right after the response submitted, the score would be 0.-->
0
{% endif %}
</span>
</span>
</span>
......
......@@ -41,7 +41,7 @@
<div class="ui-staff ui-toggle-visibility is--collapsed">
<h2 class="staff-info__title ui-staff__title ui-toggle-visibility__control">
<i class="ico icon-caret-right"></i>
<span class="staff-info__title__copy">{% trans "Remove submission from peer grading" %}</span>
<span>{% trans "Remove submission from peer grading" %}</span>
</h2>
<div class="staff-info__cancel-submission__content ui-toggle-visibility__content">
......@@ -55,7 +55,7 @@
<li>
<div class="has--warnings">
<div class="warning">
{% trans "Caution: Removing a student's submission is irreversible. It should only be used in cases where the student's submission was inappropriate." %}
{% trans "Caution: Removing a student's submission cannot be undone." %}
</div>
</div>
</li>
......
......@@ -375,10 +375,10 @@ class StaffInfoMixin(object):
cancelled_by_id=student_item_dict['student_id'],
assessment_requirements=assessment_requirements
)
return {"success": True, 'msg': self._(u"Student submission was removed from the peer grading pool."
u" If you'd like to allow the student to submit a new response,"
u" please also reset the student state of the problem from"
u" the Instructor Dashboard.")}
return {"success": True, 'msg': self._(u"The student submission has been removed from peer assessment. "
u"The student receives a grade of zero unless you reset "
u"the student's attempts for the problem to allow them to "
u"resubmit a response.")}
except (
AssessmentWorkflowError,
AssessmentWorkflowInternalError
......
......@@ -615,7 +615,7 @@ class TestCourseStaff(XBlockHandlerTestCase):
# Verify that we can render without error
params = {"submission_uuid": submission["uuid"], "comments": "Inappropriate language."}
resp = self.request(xblock, 'cancel_submission', json.dumps(params), response_format='json')
self.assertIn("Student submission was removed from the ", resp['msg'])
self.assertIn("The student submission has been removed from peer", resp['msg'])
self.assertEqual(True, resp['success'])
def _create_mock_runtime(self, item_id, is_staff, is_admin, anonymous_user_id):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment