Mark which fields support the "in the last" parameter for UI
[PREMIUM-253]
This commit is contained in:
@@ -32,6 +32,7 @@ class SubscriberAutomationFieldsFactory {
|
||||
'name' => $automation->getName() . " (#{$automation->getId()})",
|
||||
];
|
||||
}, $automations),
|
||||
'params' => ['in_the_last'],
|
||||
];
|
||||
|
||||
return [
|
||||
|
@@ -27,7 +27,10 @@ class SubscriberStatisticFieldsFactory {
|
||||
function (SubscriberPayload $payload, array $params = []) {
|
||||
$startTime = $this->getStartTime($params);
|
||||
return $this->subscriberStatisticsRepository->getTotalSentCount($payload->getSubscriber(), $startTime);
|
||||
}
|
||||
},
|
||||
[
|
||||
'params' => ['in_the_last'],
|
||||
]
|
||||
),
|
||||
new Field(
|
||||
'mailpoet:subscriber:email-opened-count',
|
||||
@@ -36,7 +39,10 @@ class SubscriberStatisticFieldsFactory {
|
||||
function (SubscriberPayload $payload, array $params = []) {
|
||||
$startTime = $this->getStartTime($params);
|
||||
return $this->subscriberStatisticsRepository->getStatisticsOpenCount($payload->getSubscriber(), $startTime);
|
||||
}
|
||||
},
|
||||
[
|
||||
'params' => ['in_the_last'],
|
||||
]
|
||||
),
|
||||
new Field(
|
||||
'mailpoet:subscriber:email-machine-opened-count',
|
||||
@@ -45,7 +51,10 @@ class SubscriberStatisticFieldsFactory {
|
||||
function (SubscriberPayload $payload, array $params = []) {
|
||||
$startTime = $this->getStartTime($params);
|
||||
return $this->subscriberStatisticsRepository->getStatisticsMachineOpenCount($payload->getSubscriber(), $startTime);
|
||||
}
|
||||
},
|
||||
[
|
||||
'params' => ['in_the_last'],
|
||||
]
|
||||
),
|
||||
new Field(
|
||||
'mailpoet:subscriber:email-clicked-count',
|
||||
@@ -54,7 +63,10 @@ class SubscriberStatisticFieldsFactory {
|
||||
function (SubscriberPayload $payload, array $params = []) {
|
||||
$startTime = $this->getStartTime($params);
|
||||
return $this->subscriberStatisticsRepository->getStatisticsClickCount($payload->getSubscriber(), $startTime);
|
||||
}
|
||||
},
|
||||
[
|
||||
'params' => ['in_the_last'],
|
||||
]
|
||||
),
|
||||
];
|
||||
}
|
||||
|
@@ -52,7 +52,10 @@ class CustomerOrderFieldsFactory {
|
||||
return $inTheLastSeconds === null
|
||||
? (float)$customer->get_total_spent()
|
||||
: $this->getRecentSpentTotal($customer, $inTheLastSeconds);
|
||||
}
|
||||
},
|
||||
[
|
||||
'params' => ['in_the_last'],
|
||||
]
|
||||
),
|
||||
new Field(
|
||||
'woocommerce:customer:spent-average',
|
||||
@@ -73,7 +76,10 @@ class CustomerOrderFieldsFactory {
|
||||
$orderCount = $this->getRecentOrderCount($customer, $inTheLastSeconds);
|
||||
}
|
||||
return $orderCount > 0 ? ($totalSpent / $orderCount) : 0.0;
|
||||
}
|
||||
},
|
||||
[
|
||||
'params' => ['in_the_last'],
|
||||
]
|
||||
),
|
||||
new Field(
|
||||
'woocommerce:customer:order-count',
|
||||
@@ -89,7 +95,10 @@ class CustomerOrderFieldsFactory {
|
||||
return $inTheLastSeconds === null
|
||||
? $customer->get_order_count()
|
||||
: $this->getRecentOrderCount($customer, $inTheLastSeconds);
|
||||
}
|
||||
},
|
||||
[
|
||||
'params' => ['in_the_last'],
|
||||
]
|
||||
),
|
||||
new Field(
|
||||
'woocommerce:customer:first-paid-order-date',
|
||||
@@ -132,6 +141,7 @@ class CustomerOrderFieldsFactory {
|
||||
},
|
||||
[
|
||||
'options' => $this->termOptionsBuilder->getTermOptions('product_cat'),
|
||||
'params' => ['in_the_last'],
|
||||
]
|
||||
),
|
||||
new Field(
|
||||
@@ -150,6 +160,7 @@ class CustomerOrderFieldsFactory {
|
||||
},
|
||||
[
|
||||
'options' => $this->termOptionsBuilder->getTermOptions('product_tag'),
|
||||
'params' => ['in_the_last'],
|
||||
]
|
||||
),
|
||||
];
|
||||
|
@@ -32,7 +32,10 @@ class CustomerReviewFieldsFactory {
|
||||
}
|
||||
$inTheLastSeconds = isset($params['in_the_last_seconds']) ? (int)$params['in_the_last_seconds'] : null;
|
||||
return $this->getUniqueProductReviewCount($customer, $inTheLastSeconds);
|
||||
}
|
||||
},
|
||||
[
|
||||
'params' => ['in_the_last'],
|
||||
]
|
||||
),
|
||||
new Field(
|
||||
'woocommerce:customer:last-review-date',
|
||||
|
Reference in New Issue
Block a user