Migrate subscribers for all tasks types [MAILPOET-903]

This commit is contained in:
stoletniy
2018-02-28 11:21:23 +03:00
parent a6f8953bd3
commit f1f69c9835
2 changed files with 2 additions and 4 deletions

View File

@@ -96,7 +96,7 @@ class Migration extends SimpleWorker {
global $wpdb;
$query = sprintf(
'SELECT queues.`task_id` FROM %1$s queues INNER JOIN %2$s tasks ON queues.`task_id` = tasks.`id` ' .
'WHERE tasks.`type` = "sending" AND (tasks.`status` IS NULL OR tasks.`status` = "paused") ' .
'WHERE tasks.`type` = "sending" ' .
'AND queues.`subscribers` != "" AND queues.`subscribers` != "N;"' .
'AND queues.`count_total` > (SELECT COUNT(*) FROM %3$s subs WHERE subs.`task_id` = queues.`task_id`)',
MP_SENDING_QUEUES_TABLE,

View File

@@ -31,8 +31,6 @@ class MigrationTest extends \MailPoetTest {
// subscribers should be migrated
$this->queue_running = $this->createSendingQueue();
$this->queue_paused = $this->createSendingQueue(SendingQueue::STATUS_PAUSED);
// subscribers should not be migrated
$this->queue_completed = $this->createSendingQueue(SendingQueue::STATUS_COMPLETED);
$this->queue_scheduled = $this->createSendingQueue(SendingQueue::STATUS_SCHEDULED);
@@ -85,7 +83,7 @@ class MigrationTest extends \MailPoetTest {
expect($this->worker->getUnmigratedQueues()->count())->equals(0);
expect(ScheduledTask::where('type', SendingTask::TASK_TYPE)->findMany())->count(4);
expect(ScheduledTaskSubscriber::whereGt('task_id', 0)->count())->equals(4); // 2 for running, 2 for paused
expect(ScheduledTaskSubscriber::whereGt('task_id', 0)->count())->equals(8); // 2 for task of each status
$queue = SendingQueue::findOne($this->queue_running->id);
$task = ScheduledTask::findOne($queue->task_id);