diff --git a/webapp/src/Controller/Jury/ExecutableController.php b/webapp/src/Controller/Jury/ExecutableController.php index 1150a037316..881504df5e1 100644 --- a/webapp/src/Controller/Jury/ExecutableController.php +++ b/webapp/src/Controller/Jury/ExecutableController.php @@ -66,6 +66,20 @@ public function indexAction(Request $request): Response $propertyAccessor = PropertyAccess::createPropertyAccessor(); $executables_table = []; + $configScripts = []; + foreach (['compare', 'run', 'full_debug'] as $config_script) { + /* Seems to fail + try { + $configScripts[] = (string)$this->config->get('default_' . $config_script); + } catch (InvalidArgumentException $e) { + // Ignore + }*/ + // If not found this is an older database, as we only use this for visual changes ignore this error; + if ($this->config->checkExistance('default_' . $config_script)) { + $configScripts[] = (string)$this->config->get('default_' . $config_script); + } + } + foreach ($executables as $e) { $execdata = []; $execactions = []; @@ -117,7 +131,7 @@ public function indexAction(Request $request): Response 'link' => $this->generateUrl('jury_executable_download', ['execId' => $e->getExecid()]) ]; - if ($e->checkEnabled()) { + if ($e->checkEnabled($configScripts)) { $executables_tables_enabled[] = [ 'data' => $execdata, 'actions' => $execactions, diff --git a/webapp/src/Entity/Executable.php b/webapp/src/Entity/Executable.php index 943bf5410f3..be79be69af2 100644 --- a/webapp/src/Entity/Executable.php +++ b/webapp/src/Entity/Executable.php @@ -182,14 +182,17 @@ public function getZipfileContent(string $tempdir): string return $zipFileContents; } - public function checkEnabled(): bool + /** + * @param string[] $configScripts + */ + public function checkEnabled(array $configScripts): bool { - foreach (['compare', 'run', 'full_debug'] as $config_script) { - if ($execid === (string)$this->config->get('default_' . $config_script)) { + foreach ($configScripts as $config_script) { + if ($this->execid === $config_script) { return true; } } - if (count($problems_compare) || count($problems_run)) { + if (count($this->problems_compare) || count($this->problems_run)) { return true; } return false; diff --git a/webapp/src/Service/ConfigurationService.php b/webapp/src/Service/ConfigurationService.php index eeeccf9d730..687bc1b9bfa 100644 --- a/webapp/src/Service/ConfigurationService.php +++ b/webapp/src/Service/ConfigurationService.php @@ -67,6 +67,16 @@ public function get(string $name, bool $onlyIfPublic = false) return $value; } + public function checkExistance(string $name): bool + { + try { + $this->get($name); + return true; + } catch (InvalidArgumentException $e) { + return false; + } + } + /** * Get all the configuration values, indexed by name. *