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

endline reminders #709

Merged
merged 2 commits into from
Nov 14, 2023
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
10 changes: 6 additions & 4 deletions yal/assessments.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,9 +425,11 @@ async def state_handle_assessment_reminder_response(self):
return await self.go_to_state("state_reschedule_assessment_reminder")

if inbound == "i m not interested":
assessment_name = ""
if "assessment_reminder_name" in self.user.metadata:
assessment_name = self.user.metadata["assessment_reminder_name"]
assessment_reminder_type = ""
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like you can replace this with a .get() and a default

if "assessment_reminder_type" in self.user.metadata:
assessment_reminder_type = self.user.metadata[
"assessment_reminder_type"
]
data = {
"assessment_reminder_name": "",
"assessment_reminder_sent": "",
Expand All @@ -438,7 +440,7 @@ async def state_handle_assessment_reminder_response(self):
if error:
return await self.go_to_state("state_error")

if "endline" in assessment_name:
if "endline" in assessment_reminder_type:
return await self.go_to_state("state_not_interested")

return await self.go_to_state("state_pre_mainmenu")
Expand Down
2 changes: 1 addition & 1 deletion yal/tests/test_assessments.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ async def test_state_handle_assessment_reminder_response_not_interested_endline(
tester: AppTester, contentrepo_api_mock, rapidpro_mock
):
tester.user.metadata["assessment_reminder_sent"] = "True"
tester.user.metadata["assessment_reminder_name"] = "self_esteem_endline"
tester.user.metadata["assessment_reminder_type"] = "endline later 23hours"
tester.setup_state("state_survey_question")
await tester.user_input("I'm not interested")
tester.assert_state("state_not_interested")
Expand Down
Loading