Skip to content
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

Added demand gen keyword #768

Merged
merged 2 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions yal/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
"i saw this on facebook",
}
TRACKING_KEYWORDS_ROUND_3 = {"youth", "yth", "yuth", "yut", "yoth", "yot", "yoh"}
TRACKING_KEYWORDS_ROUND_4 = {"registerme"}
TRACKING_KEYWORDS_TIKTOK = {"sho"}
OPTOUT_KEYWORDS = {"stop", "opt out", "cancel", "quit"}
ONBOARDING_REMINDER_KEYWORDS = {
Expand Down Expand Up @@ -151,6 +152,7 @@ async def process_message(self, message):
or keyword in TRACKING_KEYWORDS
or keyword in TRACKING_KEYWORDS_ROUND_2
or keyword in TRACKING_KEYWORDS_ROUND_3
or keyword in TRACKING_KEYWORDS_ROUND_4
or keyword in TRACKING_KEYWORDS_TIKTOK
):
self.user.session_id = None
Expand Down Expand Up @@ -310,6 +312,7 @@ async def state_start(self):
inbound in TRACKING_KEYWORDS
or inbound in TRACKING_KEYWORDS_ROUND_2
or inbound in TRACKING_KEYWORDS_ROUND_3
or inbound in TRACKING_KEYWORDS_ROUND_4
or inbound in TRACKING_KEYWORDS_TIKTOK
):
self.save_answer("state_source_tracking", inbound)
Expand All @@ -321,6 +324,7 @@ async def state_start(self):
or inbound in TRACKING_KEYWORDS
or inbound in TRACKING_KEYWORDS_ROUND_2
or inbound in TRACKING_KEYWORDS_ROUND_3
or inbound in TRACKING_KEYWORDS_ROUND_4
or inbound in TRACKING_KEYWORDS_TIKTOK
):
if terms_accepted and onboarding_completed:
Expand Down
14 changes: 14 additions & 0 deletions yal/tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -939,6 +939,20 @@ async def test_tracked_keywords_saved_for_new_user_ads_round_3(
tester.assert_answer("state_source_tracking", "yoth")


@pytest.mark.asyncio
async def test_tracked_keywords_demand_gen(
tester: AppTester, rapidpro_mock, contentrepo_api_mock
):
rapidpro_mock.tstate.contact_fields["onboarding_completed"] = ""
rapidpro_mock.tstate.contact_fields["terms_accepted"] = ""
await tester.user_input("registerme")
tester.assert_state("state_welcome")

tester.assert_num_messages(1)

tester.assert_answer("state_source_tracking", "registerme")


@pytest.mark.asyncio
async def test_tracked_keywords_tiktok(
tester: AppTester, rapidpro_mock, contentrepo_api_mock
Expand Down
Loading