Fix inconsistency between automation run and run log statuses

[MAILPOET-5568]
This commit is contained in:
Jan Jakes
2023-08-31 14:49:17 +02:00
committed by Aschepikov
parent d7addd8e55
commit d8afb42d89
4 changed files with 7 additions and 8 deletions

View File

@@ -8,10 +8,9 @@ use MailPoet\Automation\Engine\Utils\Json;
use Throwable;
class AutomationRunLog {
const STATUS_RUNNING = 'running';
const STATUS_COMPLETED = 'completed';
const STATUS_FAILED = 'failed';
public const STATUS_RUNNING = 'running';
public const STATUS_COMPLETE = 'complete';
public const STATUS_FAILED = 'failed';
/** @var int */
private $id;
@@ -113,7 +112,7 @@ class AutomationRunLog {
}
public function markCompletedSuccessfully(): void {
$this->status = self::STATUS_COMPLETED;
$this->status = self::STATUS_COMPLETE;
$this->completedAt = new DateTimeImmutable();
}

View File

@@ -67,7 +67,7 @@ class StepStatisticController {
public function getFlowStatistics(Automation $automation, Query $query): array {
$statistics = $this->automationRunLogStorage->getAutomationRunStatisticsForAutomationInTimeFrame(
$automation->getId(),
AutomationRunLog::STATUS_COMPLETED,
AutomationRunLog::STATUS_COMPLETE,
$query->getAfter(),
$query->getBefore()
);

View File

@@ -147,7 +147,7 @@ class AutomationRunLogTest extends \MailPoetTest {
$automationRunLogs = $this->getLogsForAction();
expect($automationRunLogs)->count(1);
$log = $automationRunLogs[0];
expect($log->getStatus())->equals(AutomationRunLog::STATUS_COMPLETED);
expect($log->getStatus())->equals(AutomationRunLog::STATUS_COMPLETE);
}
public function testItStoresAutomationRunAndStepIdsCorrectly() {

View File

@@ -64,7 +64,7 @@ class AutomationRunLogStorageTest extends \MailPoetTest {
'after' => new \DateTimeImmutable('2020-01-01 00:00:00'),
'before' => new \DateTimeImmutable('2020-01-02 00:00:00'),
];
$status = AutomationRunLog::STATUS_COMPLETED;
$status = AutomationRunLog::STATUS_COMPLETE;
$automationId = 1;
$this->storage->truncate();