Token not cancelled if task is invalid

* If a token is submitted to a task and that task becomes invalid
  then that task is not complete and the token should not be
  deleted

Change-Id: Ieb7610fd0fa9b626f0223e09661d167f92cfcaff
This commit is contained in:
Amelia Cordwell 2018-04-03 11:14:35 +12:00
parent 9fefbfe85b
commit 45f9970cf2
1 changed files with 3 additions and 3 deletions

View File

@ -785,14 +785,14 @@ class TokenDetail(APIViewWithLogger):
}
return Response(response_dict, status=500)
if not valid:
return Response({"errors": ["Actions invalid"]}, status=400)
token.task.completed = True
token.task.completed_on = timezone.now()
token.task.save()
token.delete()
if not valid:
return Response({"errors": ["Actions invalid"]}, status=400)
# Sending confirmation email:
class_conf = settings.TASK_SETTINGS.get(
token.task.task_type, settings.DEFAULT_TASK_SETTINGS)