run fixVotes in migration (only needed once)

Signed-off-by: dartcafe <github@dartcafe.de>
This commit is contained in:
dartcafe 2021-06-22 09:10:00 +02:00
Родитель 2062843b4d
Коммит 79bea2ecdd
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: CCE73CEF3035D3C8
5 изменённых файлов: 13 добавлений и 10 удалений

Просмотреть файл

@ -38,7 +38,6 @@
<pre-migration> <pre-migration>
<step>OCA\Polls\Migration\RemoveIndices</step> <step>OCA\Polls\Migration\RemoveIndices</step>
<step>OCA\Polls\Migration\DeleteInvalidRecords</step> <step>OCA\Polls\Migration\DeleteInvalidRecords</step>
<step>OCA\Polls\Migration\FixVotes</step>
</pre-migration> </pre-migration>
<post-migration> <post-migration>
<step>OCA\Polls\Migration\CreateIndices</step> <step>OCA\Polls\Migration\CreateIndices</step>

Просмотреть файл

@ -140,11 +140,11 @@ class Option extends Entity implements JsonSerializable {
} }
public function getPollOptionTextEnd(): string { public function getPollOptionTextEnd(): string {
if ($this->getTimestamp()) { if ($this->getTimestamp()) {
return date('c', $this->getTimestamp() + $this->getDuration()); return date('c', $this->getTimestamp() + $this->getDuration());
}
return htmlspecialchars_decode($this->pollOptionText);
} }
return htmlspecialchars_decode($this->pollOptionText);
}
public function getPollOptionTextStart(): string { public function getPollOptionTextStart(): string {
if ($this->getTimestamp()) { if ($this->getTimestamp()) {

Просмотреть файл

@ -1,8 +1,7 @@
<?php <?php
/** /**
* @copyright Copyright (c) 2017 Julius Härtl <jus@bitgrid.net> * @copyright Copyright (c) 2021 René Gieling <github@dartcafe.de>
* *
* @author Julius Härtl <jus@bitgrid.net>
* @author René Gieling <github@dartcafe.de> * @author René Gieling <github@dartcafe.de>
* *
* @license GNU AGPL version 3 or any later version * @license GNU AGPL version 3 or any later version

Просмотреть файл

@ -1,8 +1,7 @@
<?php <?php
/** /**
* @copyright Copyright (c) 2017 Julius Härtl <jus@bitgrid.net> * @copyright Copyright (c) 2021 René Gieling <github@dartcafe.de>
* *
* @author Julius Härtl <jus@bitgrid.net>
* @author René Gieling <github@dartcafe.de> * @author René Gieling <github@dartcafe.de>
* *
* @license GNU AGPL version 3 or any later version * @license GNU AGPL version 3 or any later version

Просмотреть файл

@ -45,9 +45,13 @@ class Version030000Date20210611120000 extends SimpleMigrationStep {
/** @var IConfig */ /** @var IConfig */
protected $config; protected $config;
public function __construct(IDBConnection $connection, IConfig $config) { /** @var FixVotes */
protected $fixVotes;
public function __construct(IDBConnection $connection, IConfig $config, FixVotes $fixVotes) {
$this->connection = $connection; $this->connection = $connection;
$this->config = $config; $this->config = $config;
$this->fixVotes = $fixVotes;
} }
/** /**
@ -69,6 +73,8 @@ class Version030000Date20210611120000 extends SimpleMigrationStep {
// theoretically, only this migration should be existen. If not, no matter // theoretically, only this migration should be existen. If not, no matter
TableSchema::removeObsoleteMigrations($this->connection, $output); TableSchema::removeObsoleteMigrations($this->connection, $output);
$this->fixVotes->run($output);
return $schema; return $schema;
} }
} }