Fix inconsistency between automation run and run log statuses
[MAILPOET-5568]
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
|
@@ -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()
|
||||
);
|
||||
|
@@ -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() {
|
||||
|
@@ -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();
|
||||
|
Reference in New Issue
Block a user