Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions src/apps/competitions/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -536,9 +536,10 @@ def soft_delete(self):
detail.delete() # Remove record from DB

# Clear the data field if no other submissions are using it
other_submissions_using_data = Submission.objects.filter(data=self.data).exclude(pk=self.pk).exists()
if not other_submissions_using_data:
self.data.delete()
if self.data:
other_submissions_using_data = Submission.objects.filter(data=self.data).exclude(pk=self.pk).exists()
if not other_submissions_using_data:
self.data.delete()

# Clear the data field for this submission
self.data = None
Expand All @@ -554,11 +555,12 @@ def soft_delete(self):
def delete(self, **kwargs):

# Check if any other submissions are using the same data
other_submissions_using_data = Submission.objects.filter(data=self.data).exclude(pk=self.pk).exists()
if self.data:
other_submissions_using_data = Submission.objects.filter(data=self.data).exclude(pk=self.pk).exists()

if not other_submissions_using_data:
# If no other submissions are using the same data, delete it
self.data.delete()
if not other_submissions_using_data:
# If no other submissions are using the same data, delete it
self.data.delete()

# Also clean up details on delete
self.details.all().delete()
Expand Down
11 changes: 9 additions & 2 deletions src/static/riot/competitions/detail/submission_manager.tag
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,15 @@
</a>
</td>
<!-- Show Action buttons when submission is not soft deleted -->
<!-- Otherwise show empty <td> -->
<td if="{ submission.is_soft_deleted }"></td>
<!-- For soft-deleted submissions, organizers can still hard-delete -->
<td if="{ submission.is_soft_deleted }">
<virtual if="{ opts.admin }">
<span data-tooltip="Delete Submission" data-inverted=""
onclick="{ delete_submission.bind(this, submission) }">
<i class="icon red trash alternate"></i>
</span>
</virtual>
</td>
<td class="center aligned" if="{ !submission.is_soft_deleted }">
<virtual if="{ opts.admin}">
<!-- run/rerun submission -->
Expand Down