Commit b9460c5e by muhammad-ammar

fix1

parent 92d41500
......@@ -661,6 +661,8 @@ def get_submission_to_assess(submission_uuid, graded_by):
"""
workflow = PeerWorkflow.get_by_submission_uuid(submission_uuid)
if workflow.is_cancelled:
return None
if not workflow:
raise PeerAssessmentWorkflowError(
u"A Peer Assessment Workflow does not exist for the student "
......@@ -959,8 +961,11 @@ def cancel_submission_peer_workflow(submission_uuid, comments, cancelled_by_id):
comments (str): The reason for cancellation.
cancelled_by_id (str): The ID of the user who cancelled the peer workflow.
"""
from nose.tools import set_trace; set_trace()
try:
workflow = PeerWorkflow.objects.get(submission_uuid=submission_uuid)
return PeerWorkflowCancellation.create(workflow=workflow, comments=comments, cancelled_by_id=cancelled_by_id)
except (
PeerWorkflow.DoesNotExist,
......
......@@ -119,6 +119,16 @@ class PeerWorkflow(models.Model):
ordering = ["created_at", "id"]
app_label = "assessment"
@property
def is_cancelled(self):
"""
Check if workflow is cancelled?
Returns:
True/False
"""
return bool(self.cancellations.exists())
@classmethod
def get_by_submission_uuid(cls, submission_uuid):
"""
......
......@@ -72,7 +72,7 @@ class PeerAssessmentMixin(object):
)
return {
'success': False,
'msg': self._('This feedback has already been submitted.'),
'msg': self._('This feedback has already been submitted or the submission has been cancelled.'),
}
assessment_ui_model = self.get_assessment_module('peer-assessment')
......@@ -267,6 +267,7 @@ class PeerAssessmentMixin(object):
"""
peer_submission = False
try:
from nose.tools import set_trace; set_trace()
peer_submission = peer_api.get_submission_to_assess(
self.submission_uuid,
assessment["must_be_graded_by"]
......
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