-
Notifications
You must be signed in to change notification settings - Fork 35
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
Remove people from campaigns when they no longer match campaign segments #45
Comments
@joshuap In the readme, it appears to state that this feature is already in place:
Also:
So, I have a PR in the works to implement this and close this issue, and I added some tests. However, I haven't issued it so far because it is failing the test The test, which I pasted below for a quick reference, goes through Based on the readme and on this issue, I think this test should be removed; however, it's existence makes me think this behavior is actually intended for now. Which direction should we go? :) test "it waits for segments to match" do
action = Minitest::Mock.new
campaign = create_test_campaign {
default action: action
user_type "Contact"
step :one, wait: 0
step :two, wait: 2.days, segment: ->(u) { u.traits["foo"] == "bar" }
step :three, wait: 1.day, segment: ->(u) { u.traits["bar"] == "baz" }
}
contact = contacts(:one)
contact.update_attribute(:traits, {bar: "baz"})
campaign.add(contact, send_now: false)
action.expect(:new, NullMail, [{
user: contact,
step: campaign.steps.first
}])
run_twice
assert_mock action
Timecop.travel(1.days.from_now)
run_twice
assert_mock action
Timecop.travel(1.days.from_now)
action.expect(:new, NullMail, [{
user: contact,
step: campaign.steps.third
}])
run_twice
assert_mock action |
@feliperaul I'm not sure I follow. Can you explain what specific behavior you're trying to add? (E.g. what does your PR do?) I think you're right that this issue is already implemented and can be closed. What this issue is referencing is specifically the global campaign segments feature. I think when I created this issue, heya's implementation was different. The way it works now is that it waits the maximum The "it waits for segments to match" test looks correct to me, although maybe it could be named better. Basically what that test is asserting is that the campaign waits the full |
If they don't match campaign segments, they won't match any steps. Removing them early means that if they get re-added to a campaign once the do match again, they'll continue to receive emails where they left off. Currently, the system will just skip every step until they exit the campaign anyway.
The text was updated successfully, but these errors were encountered: