Query all runs when no status has been added

[MAILPOET-5514]
This commit is contained in:
David Remer
2023-09-07 10:03:26 +03:00
committed by Aschepikov
parent 976ea06ebc
commit b9ecac91d4
2 changed files with 10 additions and 3 deletions

View File

@@ -134,11 +134,18 @@ class AutomationRunStorage {
}
public function getCountForAutomation(Automation $automation, string ...$status): int {
$table = esc_sql($this->table);
if (!count($status)) {
return 0;
$query = (string)$this->wpdb->prepare("
SELECT COUNT(id) as count
FROM $table
WHERE automation_id = %d
", $automation->getId());
$result = $this->wpdb->get_col($query);
return $result ? (int)current($result) : 0;
}
$table = esc_sql($this->table);
$statusSql = (string)$this->wpdb->prepare(implode(',', array_fill(0, count($status), '%s')), ...$status);
$query = (string)$this->wpdb->prepare("
SELECT COUNT(id) as count

View File

@@ -44,7 +44,7 @@ parameters:
- '/Call to method getName\(\) on an unknown class _generated\\([a-zA-Z])*Cookie/' # codeception generate incorrect return type in ../../tests/_support/_generated
-
message: "#^Cannot cast string|void to string\\.$#"
count: 10
count: 11
path: ../../lib/Automation/Engine/Storage/AutomationRunStorage.php
-
message: "#^Cannot cast string|void to string\\.$#"