From 70075cc14007e6b996213efeefcdedb8c5ff2ab0 Mon Sep 17 00:00:00 2001 From: bencroker Date: Sun, 7 Apr 2024 07:43:05 -0600 Subject: [PATCH] Fix recipient count bug and typo --- CHANGELOG.md | 7 +++++++ composer.json | 2 +- src/batchers/SendoutBatcher.php | 3 ++- src/jobs/SendoutJob.php | 2 +- src/translations/en/campaign.php | 2 +- tests/TESTS.md | 8 ++++---- 6 files changed, 16 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7eb716c8..f3e9a7b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Release Notes for Campaign +## 2.13.3 - Unreleased + +### Fixed + +- Fixed a bug in which the total recipient count in running sendouts was being incorrectly displayed. +- Fixed a typo in the `All` interaction type in English. + ## 2.13.2 - 2024-04-01 ### Fixed diff --git a/composer.json b/composer.json index bb3c3e6f..9c120e9c 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "putyourlightson/craft-campaign", "description": "Send and manage email campaigns, contacts and mailing lists.", - "version": "2.13.2", + "version": "2.13.3", "type": "craft-plugin", "homepage": "https://putyourlightson.com/plugins/campaign", "license": "proprietary", diff --git a/src/batchers/SendoutBatcher.php b/src/batchers/SendoutBatcher.php index ff4af77c..cabd7695 100644 --- a/src/batchers/SendoutBatcher.php +++ b/src/batchers/SendoutBatcher.php @@ -13,6 +13,7 @@ class SendoutBatcher implements Batchable { public function __construct( private ?SendoutElement $sendout, + private int $offset = 0, ) { } @@ -28,7 +29,7 @@ public function count(): int // Return the number of pending plus sent recipients. $pendingRecipientCount = Campaign::$plugin->sendouts->getPendingRecipientCount($this->sendout); - return $pendingRecipientCount + $this->sendout->recipients; + return $pendingRecipientCount + $this->offset; } /** diff --git a/src/jobs/SendoutJob.php b/src/jobs/SendoutJob.php index 1d584c29..d0a99e7c 100644 --- a/src/jobs/SendoutJob.php +++ b/src/jobs/SendoutJob.php @@ -117,7 +117,7 @@ protected function loadData(): SendoutBatcher return new SendoutBatcher(null); } - return new SendoutBatcher($sendout); + return new SendoutBatcher($sendout, $this->itemOffset); } /** diff --git a/src/translations/en/campaign.php b/src/translations/en/campaign.php index f3549a50..7bceee57 100644 --- a/src/translations/en/campaign.php +++ b/src/translations/en/campaign.php @@ -37,7 +37,7 @@ 'Add the following tag to all Campaign forms (not doing so will prevent forms from submitting).' => '', 'Added' => '', 'Alias Check Failed – one of your site or asset volume URLs is using a dynamic `@web` alias.' => '', - 'All' => 'Alle', + 'All' => '', 'All campaigns' => '', 'All contacts' => '', 'All mailing lists' => '', diff --git a/tests/TESTS.md b/tests/TESTS.md index 7649d7cf..d43695ba 100644 --- a/tests/TESTS.md +++ b/tests/TESTS.md @@ -25,7 +25,7 @@ _Tests contact interactions with campaigns._ _Tests properties of contacts._ ![Pass](https://raw.githubusercontent.com/putyourlightson/craft-generate-test-spec/main/icons/pass.svg) A contact with the same email address as another contact cannot be saved. -![Pass](https://raw.githubusercontent.com/putyourlightson/craft-generate-test-spec/main/icons/pass.svg) A contact with the same email address as a soft deleted contact can be saved. +![Pass](https://raw.githubusercontent.com/putyourlightson/craft-generate-test-spec/main/icons/pass.svg) A contact with the same email address as a soft-deleted contact can be saved. ### [Form](pest/Feature/FormTest.php) @@ -50,9 +50,9 @@ _Tests importing contacts into mailing lists._ _Tests verifying pending contacts._ ![Pass](https://raw.githubusercontent.com/putyourlightson/craft-generate-test-spec/main/icons/pass.svg) Verifying a pending contact creates a contact. -![Pass](https://raw.githubusercontent.com/putyourlightson/craft-generate-test-spec/main/icons/pass.svg) Verifying a pending contact for a soft deleted contact restores the contact. -![Pass](https://raw.githubusercontent.com/putyourlightson/craft-generate-test-spec/main/icons/pass.svg) Verifying a pending contact soft deletes the pending contact. -![Pass](https://raw.githubusercontent.com/putyourlightson/craft-generate-test-spec/main/icons/pass.svg) Verifying a soft deleted pending does nothing. +![Pass](https://raw.githubusercontent.com/putyourlightson/craft-generate-test-spec/main/icons/pass.svg) Verifying a pending contact for a soft-deleted contact restores the contact. +![Pass](https://raw.githubusercontent.com/putyourlightson/craft-generate-test-spec/main/icons/pass.svg) Verifying a pending contact soft-deletes the pending contact. +![Pass](https://raw.githubusercontent.com/putyourlightson/craft-generate-test-spec/main/icons/pass.svg) Verifying a soft-deleted pending does nothing. ### [PendingRecipient](pest/Feature/PendingRecipientTest.php)