Просмотр исходного кода

Add location names to error message if conflicting locations are found when moving tests to another project

Alan Lam 2 лет назад
Родитель
Сommit
461b51726c
1 измененных файлов с 6 добавлено и 1 удалено
  1. 6 1
      controllers/project.php

+ 6 - 1
controllers/project.php

@@ -63,7 +63,12 @@ if($action) {
 			$conflicting_tests = Test::query(["location_id" => $location_ids, "project_id" => $target_project_id, "status" => Constraint::notEquals(Test::STATUS_CANCELLED)]);
 			$conflicting_test_count = count($conflicting_tests);
 			if($conflicting_test_count > 0) {
-				throw new RuntimeException(__("%d conflicting test(s) for a location was found in the target project. Please remove from the target project and try again.", $conflicting_test_count));
+				$location_names = [];
+				foreach($conflicting_tests as $conflicting_test) {
+					$location_names[] = $conflicting_test->getLocation()->name;
+				}
+
+				throw new RuntimeException(__("%d conflicting test(s) were found in the target project. Locations: %s", $conflicting_test_count, implode(", ", $location_names)));
 			}
 
 			// OK at this point