Skip to content

Commit feaae26

Browse files
committed
Fix recipient count double counting failures
1 parent 121f49d commit feaae26

3 files changed

Lines changed: 8 additions & 6 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Release Notes for Campaign
22

3+
## 3.8.2 - Unreleased
4+
5+
- Fixed a bug in which the number of recipients could be lower than expected when send failures occur ([#547](https://github.com/putyourlightson/craft-campaign/issues/547)).
6+
37
## 3.8.1 - 2025-12-23
48

59
- Fixed a bug in which campaigns could not be closed ([#539](https://github.com/putyourlightson/craft-campaign/issues/539)).

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "putyourlightson/craft-campaign",
33
"description": "Send and manage email campaigns, contacts and mailing lists.",
4-
"version": "3.8.1",
4+
"version": "3.8.2",
55
"type": "craft-plugin",
66
"homepage": "https://putyourlightson.com/plugins/campaign",
77
"license": "proprietary",

src/services/SendoutsService.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,19 +116,17 @@ public function getPendingRecipients(SendoutElement $sendout, int $limit = null)
116116
}
117117

118118
/**
119-
* Returns the number of pending recipients, not including failed attempts.
119+
* Returns the number of pending recipients.
120120
*/
121121
public function getPendingRecipientCount(SendoutElement $sendout): int
122122
{
123123
if ($sendout->sendoutType === 'regular' || $sendout->sendoutType === 'scheduled') {
124-
$count = ContactElement::find()
124+
return ContactElement::find()
125125
->id($this->getPendingRecipientsStandardIds($sendout))
126126
->count();
127-
} else {
128-
$count = count($this->getPendingRecipients($sendout));
129127
}
130128

131-
return $count - $sendout->failures;
129+
return count($this->getPendingRecipients($sendout));
132130
}
133131

134132
/**

0 commit comments

Comments
 (0)