Skip to content
Snippets Groups Projects
Commit bfd7ff7b authored by Theo Lesage's avatar Theo Lesage Committed by Bastien Abadie
Browse files

Fix interity error on old task

parent 7ed5c383
No related branches found
No related tags found
1 merge request!2304Link tasks to their restarts
......@@ -236,6 +236,10 @@ class TaskRestart(ProcessACLMixin, CreateAPIView):
# Rename the original task
basename, *_ = copy.slug.rsplit("_old", 1)
if copy.original_task_id:
basename, *_ = copy.slug.rsplit("_old", 1)
else:
basename = copy.slug
latest_task = Task.objects.filter(run=copy.run, slug__startswith=f"{basename}_old").order_by("-created").first()
if not latest_task:
# There is no previously restarted task: the original task will have the slug slug_old1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment