Skip to content

Commit

Permalink
Opravy chyb helpdesk (#797)
Browse files Browse the repository at this point in the history
* block capacity check fix

* check tables existence fix

* downgrade nette forms
  • Loading branch information
jan-stanek authored Mar 1, 2021
1 parent ffbeb34 commit 35d5269
Show file tree
Hide file tree
Showing 5 changed files with 823 additions and 152 deletions.
2 changes: 1 addition & 1 deletion app/AdminModule/ProgramModule/Forms/BlockFormFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public function create(int $id, int $userId): Form
$capacityText->addCondition(Form::FILLED)
->addRule(Form::INTEGER, 'admin.program.blocks.form.capacity_format')
->toggle('alternatesAllowedCheckbox');
$minAllowedCapacity = $this->queryBus->handle(new MinBlockAllowedCapacityQuery($this->block));
$minAllowedCapacity = $this->block !== null ? $this->queryBus->handle(new MinBlockAllowedCapacityQuery($this->block)) : null;
if ($minAllowedCapacity !== null) {
$capacityText->addCondition(Form::FILLED)
->addRule(Form::MIN, 'admin.program.blocks.form.capacity_low', $minAllowedCapacity);
Expand Down
19 changes: 6 additions & 13 deletions app/InstallModule/Presenters/InstallPresenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use App\Model\Acl\Repositories\RoleRepository;
use App\Model\Acl\Role;
use App\Model\Settings\Commands\SetSettingBoolValue;
use App\Model\Settings\Exceptions\SettingsItemNotFoundException;
use App\Model\Settings\Queries\SettingBoolValueQuery;
use App\Model\Settings\Settings;
use App\Model\Structure\Repositories\SubeventRepository;
Expand All @@ -17,14 +16,14 @@
use App\Services\QueryBus;
use Contributte\Console\Application;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\DBAL\Exception\TableNotFoundException;
use Doctrine\Migrations\Tools\Console\Command\MigrateCommand;
use Doctrine\ORM\EntityManagerInterface;
use Exception;
use Nette\Application\AbortException;
use Skautis\Skautis;
use Skautis\Wsdl\WsdlException;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Messenger\Exception\HandlerFailedException;
use Throwable;
use Tracy\Debugger;
use Tracy\ILogger;
Expand Down Expand Up @@ -84,8 +83,8 @@ public function renderDefault(): void

$this->flashMessage('install.schema.schema_already_created', 'info');
$this->redirect('admin');
} catch (TableNotFoundException $ex) {
} catch (SettingsItemNotFoundException $ex) {
} catch (HandlerFailedException $ex) {
// ignoruje se, tabulky ještě nejsou vytvořeny
}
}

Expand Down Expand Up @@ -126,9 +125,7 @@ public function renderAdmin(): void
$this->flashMessage('install.admin.admin_already_created', 'info');
$this->redirect('finish');
}
} catch (TableNotFoundException $ex) {
$this->redirect('default');
} catch (SettingsItemNotFoundException $ex) {
} catch (HandlerFailedException $ex) {
$this->redirect('default');
}

Expand Down Expand Up @@ -185,9 +182,7 @@ public function renderFinish(): void
if (! $this->queryBus->handle(new SettingBoolValueQuery(Settings::ADMIN_CREATED))) {
$this->redirect('default');
}
} catch (TableNotFoundException $ex) {
$this->redirect('default');
} catch (SettingsItemNotFoundException $ex) {
} catch (HandlerFailedException $ex) {
$this->redirect('default');
}
}
Expand All @@ -204,9 +199,7 @@ public function renderInstalled(): void
if (! $this->queryBus->handle(new SettingBoolValueQuery(Settings::ADMIN_CREATED))) {
$this->redirect('default');
}
} catch (TableNotFoundException $ex) {
$this->redirect('default');
} catch (SettingsItemNotFoundException $ex) {
} catch (HandlerFailedException $ex) {
$this->redirect('default');
}
}
Expand Down
6 changes: 2 additions & 4 deletions app/WebModule/Presenters/WebBasePresenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
use App\Services\CmsService;
use App\Services\QueryBus;
use App\Services\SkautIsService;
use Doctrine\DBAL\Exception\TableNotFoundException;
use Nette\Application\AbortException;
use Symfony\Component\Messenger\Exception\HandlerFailedException;
use Throwable;
use WebLoader\Nette\CssLoader;
use WebLoader\Nette\JavaScriptLoader;
Expand Down Expand Up @@ -140,9 +140,7 @@ private function checkInstallation(): void
if (! $this->queryBus->handle(new SettingBoolValueQuery(Settings::ADMIN_CREATED))) {
$this->redirect(':Install:Install:default');
}
} catch (TableNotFoundException $ex) {
$this->redirect(':Install:Install:default');
} catch (SettingsItemNotFoundException $ex) {
} catch (HandlerFailedException $ex) {
$this->redirect(':Install:Install:default');
}
}
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"nette/database": "^3.1",
"nette/di": "^3.0",
"nette/finder": "^2.5",
"nette/forms": "^3.0",
"nette/forms": "~3.0.0",
"nette/http": "^3.1",
"nette/mail": "^3.1",
"nette/robot-loader": "^3.3",
Expand Down
Loading

0 comments on commit 35d5269

Please sign in to comment.