Add calculation segment score

[MAILPOET-3533]
This commit is contained in:
Jan Lysý
2021-05-05 08:50:00 +02:00
committed by Veljko V
parent a92943ff30
commit 6d0486cfc5
5 changed files with 105 additions and 7 deletions

View File

@ -43,7 +43,7 @@ class Settings extends APIEndpoint {
/** @var StatisticsOpensRepository */
private $statisticsOpensRepository;
public $permissions = [
'global' => AccessControl::PERMISSION_MANAGE_SETTINGS,
];
@ -103,6 +103,7 @@ class Settings extends APIEndpoint {
public function recalculateSubscribersScore() {
$this->statisticsOpensRepository->resetSubscribersScoreCalculation();
$this->statisticsOpensRepository->resetNewslettersScoreCalculation();
$task = new ScheduledTaskEntity();
$task->setType(SubscribersEngagementScore::TASK_TYPE);
$task->setScheduledAt(Carbon::createFromTimestamp($this->wp->currentTime('timestamp')));