Skip to content

Commit

Permalink
Exclude drafts when calculating pending recipients
Browse files Browse the repository at this point in the history
  • Loading branch information
bencroker committed Oct 8, 2024
1 parent a5cc293 commit eb93dfc
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Release Notes for Campaign

## 3.5.3 - Unreleased
## 3.5.3 - 2024-10-08

### Fixed

- Fixed the calculation of pending recipients to not include drafts.
- Fixed the sendout status colour indicators on sendout preview pages.

## 3.5.2 - 2024-10-04
Expand Down
4 changes: 3 additions & 1 deletion src/records/ContactMailingListRecord.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,13 @@ public static function tableName(): string
*/
public static function find(): ActiveQuery
{
// Create a subquery to ensure only contacts and mailing lists that are not deleted are returned
// Create a subquery to ensure only contacts and mailing lists that are not drafts not deleted are returned
$subquery = parent::find()
->innerJoin(Table::ELEMENTS . ' contactElement', '[[contactElement.id]] = [[contactId]]')
->innerJoin(Table::ELEMENTS . ' mailingListElement', '[[mailingListElement.id]] = [[mailingListId]]')
->where([
'contactElement.draftId' => null,
'mailingListElement.draftId' => null,
'contactElement.dateDeleted' => null,
'mailingListElement.dateDeleted' => null,
]);
Expand Down
2 changes: 1 addition & 1 deletion src/services/SendoutsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ private function getPendingRecipientsStandardIds(SendoutElement $sendout): array
// Get contacts subscribed to sendout’s mailing lists
$query = ContactMailingListRecord::find()
->select(['contactId'])
->andWhere($baseCondition);
->where($baseCondition);

// Ensure contacts have not complained, bounced, or been blocked (in contact record)
$query->innerJoin(ContactRecord::tableName() . ' contact', '[[contact.id]] = [[contactId]]')
Expand Down

0 comments on commit eb93dfc

Please sign in to comment.