Download & Extend

simplenews_newsletter.sent_subscriber_count is always 0

Project:Simplenews
Version:7.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:corvus_ch
Status:closed (fixed)
Issue tags:Needs tests

Issue Summary

See title.

The value is always zero, looks like it's completely ignored. Beside initializing it to 0 is that column never referenced at all, so it's completely missing and not simply broken.

I think we do have to extend simplenews_mail_spool(), count the sent mails per nid and not global and execute an update query for each nid.

We can the extend the existing send tests and assert the correct amount a few times in some of the existing send tests, that should be enough. maybe add a test that sends two nodes to two different categories in parallel to make sure they are both updated correctly.

Additionally, we can extend it for the content translation integration and use the actually used nid. SimplenewsSpool already has support for this, see getProcessed().

Comments

#1

Status:active» needs review

Patch attached, including tests.

AttachmentSizeStatusTest resultOperations
sent_subscriber_count.patch7.15 KBIdleFAILED: [[SimpleTest]]: [MySQL] 1,797 pass(es), 2 fail(s), and 1 exception(s).View details

#2

Status:needs review» needs work

The last submitted patch, sent_subscriber_count.patch, failed testing.

#3

Status:needs work» needs review

Yay testbot!

Looks like we found yet another column that is missing when upgrading from 6.x-1.x. This should fix this.

AttachmentSizeStatusTest resultOperations
sent_subscriber_count-1532116-3.patch7.6 KBIdlePASSED: [[SimpleTest]]: [MySQL] 1,807 pass(es).View details

#4

The update query took 3,7s on a database with 100 newsletters and 10k subscribers. Will need to think of a way to allow that query to scale better. Probably do one query per category instead of a subquery.

#5

Ok, here is a patch with an update function that can handle much more newsletters. Got the execution time down on my test environment with 8k subscribers and 5,5k newsletters from 50s to 0,05s.

AttachmentSizeStatusTest resultOperations
sent_subscriber_count-1532116-5.patch7.26 KBIdleFAILED: [[SimpleTest]]: [MySQL] 1,754 pass(es), 6 fail(s), and 12 exception(s).View details

#6

Status:needs review» needs work

The last submitted patch, sent_subscriber_count-1532116-5.patch, failed testing.

#7

Status:needs work» needs review

This should fix the test failures.

AttachmentSizeStatusTest resultOperations
sent_subscriber_count-1532116-7.patch7.34 KBIdlePASSED: [[SimpleTest]]: [MySQL] 1,842 pass(es).View details

#8

Status:needs review» needs work

The last submitted patch, sent_subscriber_count-1532116-7.patch, failed testing.

#9

Status:needs work» needs review

#7: sent_subscriber_count-1532116-7.patch queued for re-testing.

#10

Status:needs review» fixed

Ok, passes, commited.

#11

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.