Commit d0800d19 by Muzaffar yousaf

Merge pull request #669 from edx/muzaffar/cancel-sub-fixes-tnl1354

UI/Text fixes related to the cancel submission process.
parents 26025e0c c111e009
...@@ -985,8 +985,9 @@ def on_cancel(submission_uuid): ...@@ -985,8 +985,9 @@ def on_cancel(submission_uuid):
""" """
try: try:
workflow = PeerWorkflow.get_by_submission_uuid(submission_uuid) workflow = PeerWorkflow.get_by_submission_uuid(submission_uuid)
workflow.cancelled_at = timezone.now() if workflow:
workflow.save() workflow.cancelled_at = timezone.now()
workflow.save()
except (PeerAssessmentWorkflowError, DatabaseError): except (PeerAssessmentWorkflowError, DatabaseError):
error_message = ( error_message = (
u"An internal error occurred while cancelling the peer" u"An internal error occurred while cancelling the peer"
......
...@@ -965,6 +965,18 @@ class TestPeerApi(CacheResetTest): ...@@ -965,6 +965,18 @@ class TestPeerApi(CacheResetTest):
workflow = PeerWorkflow.get_by_submission_uuid(buffy_sub["uuid"]) workflow = PeerWorkflow.get_by_submission_uuid(buffy_sub["uuid"])
self.assertTrue(workflow.is_cancelled) 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): def test_get_workflow_by_uuid(self):
buffy_answer, _ = self._create_student_and_submission("Buffy", "Buffy's answer") buffy_answer, _ = self._create_student_and_submission("Buffy", "Buffy's answer")
self._create_student_and_submission("Xander", "Xander's answer") self._create_student_and_submission("Xander", "Xander's answer")
......
...@@ -7,11 +7,16 @@ ...@@ -7,11 +7,16 @@
<span class="step__label">{% trans "Your Grade" %}: </span> <span class="step__label">{% trans "Your Grade" %}: </span>
<span class="grade__value"> <span class="grade__value">
<span class="grade__value__title"> <span class="grade__value__title">
{% with points_earned_string=score.points_earned|stringformat:"s" points_possible_string=score.points_possible|stringformat:"s" %} {% if score %}
{% 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 %} {% with points_earned_string=score.points_earned|stringformat:"s" points_possible_string=score.points_possible|stringformat:"s" %}
{{ points_earned }} out of {{ points_possible }} {% 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 %}
{% endblocktrans %} {{ points_earned }} out of {{ points_possible }}
{% endwith %} {% endblocktrans %}
{% endwith %}
{% else %}
<!--When submission is cancelled right after the response submitted, the score would be 0.-->
0
{% endif %}
</span> </span>
</span> </span>
</span> </span>
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
<div class="ui-staff ui-toggle-visibility is--collapsed"> <div class="ui-staff ui-toggle-visibility is--collapsed">
<h2 class="staff-info__title ui-staff__title ui-toggle-visibility__control"> <h2 class="staff-info__title ui-staff__title ui-toggle-visibility__control">
<i class="ico icon-caret-right"></i> <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> </h2>
<div class="staff-info__cancel-submission__content ui-toggle-visibility__content"> <div class="staff-info__cancel-submission__content ui-toggle-visibility__content">
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
<li> <li>
<div class="has--warnings"> <div class="has--warnings">
<div class="warning"> <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>
</div> </div>
</li> </li>
......
...@@ -375,10 +375,10 @@ class StaffInfoMixin(object): ...@@ -375,10 +375,10 @@ class StaffInfoMixin(object):
cancelled_by_id=student_item_dict['student_id'], cancelled_by_id=student_item_dict['student_id'],
assessment_requirements=assessment_requirements assessment_requirements=assessment_requirements
) )
return {"success": True, 'msg': self._(u"Student submission was removed from the peer grading pool." return {"success": True, 'msg': self._(u"The student submission has been removed from peer assessment. "
u" If you'd like to allow the student to submit a new response," u"The student receives a grade of zero unless you reset "
u" please also reset the student state of the problem from" u"the student's attempts for the problem to allow them to "
u" the Instructor Dashboard.")} u"resubmit a response.")}
except ( except (
AssessmentWorkflowError, AssessmentWorkflowError,
AssessmentWorkflowInternalError AssessmentWorkflowInternalError
......
...@@ -615,7 +615,7 @@ class TestCourseStaff(XBlockHandlerTestCase): ...@@ -615,7 +615,7 @@ class TestCourseStaff(XBlockHandlerTestCase):
# Verify that we can render without error # Verify that we can render without error
params = {"submission_uuid": submission["uuid"], "comments": "Inappropriate language."} params = {"submission_uuid": submission["uuid"], "comments": "Inappropriate language."}
resp = self.request(xblock, 'cancel_submission', json.dumps(params), response_format='json') 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']) self.assertEqual(True, resp['success'])
def _create_mock_runtime(self, item_id, is_staff, is_admin, anonymous_user_id): 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