Skip to content

Commit

Permalink
survey start
Browse files Browse the repository at this point in the history
  • Loading branch information
Hlamallama committed Jul 27, 2023
1 parent f5b561a commit cb67456
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
11 changes: 7 additions & 4 deletions yal/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,12 @@
QA_RESET_FEEDBACK_TIMESTAMP_KEYWORDS = {"resetfeedbacktimestampobzvmp"}
EMERGENCY_KEYWORDS = utils.get_keywords("emergency")
AAQ_KEYWORDS = {"ask a question"}
EJAF_ENDLINE_SURVEY_KEYWORDS = {"answer", "yes i want to answer", "remind me tomorrow", "i m not interested"}
EJAF_ENDLINE_SURVEY_KEYWORDS = {
"answer",
"yes i want to answer",
"remind me tomorrow",
"i m not interested",
}


class Application(
Expand Down Expand Up @@ -180,7 +185,7 @@ async def process_message(self, message):
if self.user.metadata.get("onboarding_reminder_sent"):
self.user.session_id = None
self.state_name = OnboardingApplication.REMINDER_STATE

if keyword in ASSESSMENT_REENGAGEMENT_KEYWORDS:
if self.user.metadata.get("assessment_reminder_sent"):
self.user.session_id = None
Expand All @@ -190,7 +195,6 @@ async def process_message(self, message):
self.user.session_id = None
self.state_name = "state_baseline_start"


baseline_survey_completed = self.user.metadata.get(
"baseline_survey_completed"
)
Expand All @@ -206,7 +210,6 @@ async def process_message(self, message):
self.save_metadata("assessment_reminder_sent", False)
self.save_metadata("assessment_reminder_name", "")


if keyword == "remind me tomorrow":
self.user.session_id = None
self.state_name = AssessmentApplication.REMINDER_STATE
Expand Down
8 changes: 6 additions & 2 deletions yal/tests/surveys/test_endline.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,11 @@ async def test_endline_invitation_i_want_to_answer(tester: AppTester, rapidpro_m

assert user.state.name == "state_start_terms"


@pytest.mark.asyncio
async def test_endline_invitation_remind_me_tomorrow(
tester: AppTester, rapidpro_mock,
tester: AppTester,
rapidpro_mock,
):
user = User(
addr="278201234567",
Expand All @@ -115,9 +117,11 @@ async def test_endline_invitation_remind_me_tomorrow(

assert user.state.name == "state_remind_tomorrow"


@pytest.mark.asyncio
async def test_endline_invitation_not_interested(
tester: AppTester, rapidpro_mock,
tester: AppTester,
rapidpro_mock,
):
user = User(
addr="278201234567",
Expand Down

0 comments on commit cb67456

Please sign in to comment.