Skip to content

Commit 7f9644b

Browse files
committed
Fixing exercise files cleanup command so that linked files are not deleted.
1 parent 3289c63 commit 7f9644b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

app/model/repository/ExerciseFiles.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ public function findUnused(): array
2929
(SELECT a FROM App\Model\Entity\Assignment a WHERE a MEMBER OF f.assignments AND a.deletedAt IS NULL)
3030
AND NOT EXISTS
3131
(SELECT p FROM App\Model\Entity\Pipeline p WHERE p MEMBER OF f.pipelines AND p.deletedAt IS NULL)
32+
AND NOT EXISTS
33+
(SELECT l FROM App\Model\Entity\ExerciseFileLink l
34+
LEFT JOIN l.exercise le LEFT JOIN l.assignment la
35+
WHERE l.exerciseFile = f AND le.deletedAt IS NULL AND la.deletedAt IS NULL)
3236
");
3337

3438
return $query->getResult();

0 commit comments

Comments
 (0)