From a286f5d30bc2ea9c97f03fbaa726d40e5c72aab1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Kruli=C5=A1?= Date: Sun, 22 Nov 2026 12:17:27 +0100 Subject: [PATCH] Fixing bug in exercise tests renaming. --- app/V1Module/presenters/ExercisesConfigPresenter.php | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/app/V1Module/presenters/ExercisesConfigPresenter.php b/app/V1Module/presenters/ExercisesConfigPresenter.php index 6e5aee270..00dfe2a67 100644 --- a/app/V1Module/presenters/ExercisesConfigPresenter.php +++ b/app/V1Module/presenters/ExercisesConfigPresenter.php @@ -745,8 +745,6 @@ public function checkGetTests(string $id) public function actionGetTests(string $id) { $exercise = $this->exercises->findOrThrow($id); - - // Get to da responsa! $this->sendSuccessResponse($exercise->getExerciseTests()->getValues()); } @@ -782,6 +780,7 @@ public function actionSetTests(string $id) */ $newTests = []; + /** @var array */ $namesToOldIds = []; // new test name => old test ID $testsModified = false; @@ -810,11 +809,6 @@ public function actionSetTests(string $id) if ($testEntity === null) { // new exercise test was requested to be created $testsModified = true; - - if ($exercise->getExerciseTestByName($name)) { - throw new InvalidApiArgumentException('tests', "given test name '$name' is already taken"); - } - $testEntity = new ExerciseTest($name, $description, $this->getCurrentUser()); $this->exerciseTests->persist($testEntity); } elseif ($testEntity->getName() !== $name || $testEntity->getDescription() !== $description) {