Skip to content

Making campaign actions stats work with manual removal #14809

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: 5.2
Choose a base branch
from

Conversation

JonasLudwig1998
Copy link
Contributor

@JonasLudwig1998 JonasLudwig1998 commented Mar 27, 2025

Q A
Bug fix? (use the a.b branch) ✔️
New feature/enhancement? (use the a.x branch) ✔️❌
Deprecations? ✔️❌
BC breaks? (use the c.x branch) ✔️❌
Automated tests included? ✔️
Related user documentation PR URL mautic/user-documentation#...
Related developer documentation PR URL mautic/developer-documentation-new#...
Issue(s) addressed Fixes #14761

Description

This PR fixes the issue #14761 and makes sure the campaign action statistics work properly even when manually removing a contact via the change campaigns action
image
Before the campaign actions of a lead where considered just as 'pending' when the lead was manually removed from a campaign even if the actions where already executed before.


📋 Steps to test this PR:

  1. Open this PR on Gitpod or pull down for testing locally (see docs on testing PRs here)
  2. Create a campaign with an arbitrary action (e.g. update contact) and the change campaigns action in which you remove the contact from the current campaign
  3. Run the cron jobs mautic:campaigns:update and mautic:campaigns:trigger
  4. Navigate to campaign action stats and check if both actions were registered there as successful
image
  1. Next create a campaign with two update contact actions. The second one should have a delay of 15min before being executed.
  2. Run the cron jobs mautic:campaigns:update and mautic:campaigns:trigger
  3. Next check the campaign action stats: Here for the first action one successful run should be registered and for the second action one 'pending' should be registered
  4. Now remove the contact manually from the campaign
image
  1. Next check the campaign action stats again: For the first action there should be still registered on successful fun. However, for the second action the 'pending' shouldn't exist anymore. So there should be neither a completed action nor a pending action

Copy link

codecov bot commented Mar 27, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 63.67%. Comparing base (0db1736) to head (8fa05ee).
Report is 175 commits behind head on 5.2.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##                5.2   #14809      +/-   ##
============================================
+ Coverage     63.45%   63.67%   +0.21%     
- Complexity    34635    34662      +27     
============================================
  Files          2273     2273              
  Lines        103603   103705     +102     
============================================
+ Hits          65739    66029     +290     
+ Misses        37864    37676     -188     
Files with missing lines Coverage Δ
...s/CampaignBundle/Controller/CampaignController.php 69.33% <100.00%> (+1.36%) ⬆️
...s/CampaignBundle/Entity/LeadEventLogRepository.php 81.45% <100.00%> (+0.60%) ⬆️
...undles/CampaignBundle/Entity/SummaryRepository.php 95.45% <ø> (ø)

... and 49 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@matbcvo matbcvo added this to the 5.2.5 milestone Mar 27, 2025
@escopecz escopecz added bug Issues or PR's relating to bugs ready-to-test PR's that are ready to test campaigns Anything related to campaigns and campaign builder labels Mar 28, 2025
@escopecz escopecz moved this to 🦸🏻 Needs 2 tests in Open Source Fridays Mar 28, 2025
Copy link

@Bastian2718 Bastian2718 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@Bastian2718
Copy link

Actions do not get Pending status if an Action before is delayed and not executed at that moment. Is it a Bug or should it be like this? (Also before the Patch)

@RCheesley RCheesley linked an issue Apr 1, 2025 that may be closed by this pull request
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues or PR's relating to bugs campaigns Anything related to campaigns and campaign builder ready-to-test PR's that are ready to test
Projects
Status: 🦸🏻 Needs 2 tests
Development

Successfully merging this pull request may close these issues.

Campaign Stats stay on pending if Contact was removed from Campaign
4 participants