Skip to content

Commit

Permalink
Merge pull request #642 from praekeltfoundation/fix_30_min_reminder
Browse files Browse the repository at this point in the history
30 min reminder
  • Loading branch information
Hlamallama authored Jul 25, 2023
2 parents ddbc905 + ffe4a6c commit c048fc4
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 4 deletions.
22 changes: 20 additions & 2 deletions yal/endline_terms_and_conditions.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
WhatsAppListState,
)
from yal import rapidpro
from yal.assessments import Application as AssessmentApplication
from yal.surveys.endline import Application as EndlineApplication
from yal.utils import get_current_datetime, get_generic_error, normalise_phonenumber

Expand Down Expand Up @@ -218,7 +217,26 @@ async def state_set_reminder_timer(self):
if error:
return await self.go_to_state("state_error")

return await self.go_to_state(AssessmentApplication.LATER_STATE)
question = self._(
"\n".join(
[
"[persona_emoji] No worries, we get it!",
"",
"I'll send you a reminder message in 30 mins, so you can come back "
"and answer these questions.",
"",
"Check you later 🤙🏾",
]
)
)

return WhatsAppButtonState(
self,
question=question,
choices=[Choice("menu", "Go to main menu")],
error=get_generic_error(),
next="state_pre_mainmenu",
)

async def state_submit_terms_and_conditions_endline(self):
msisdn = normalise_phonenumber(self.inbound.from_addr)
Expand Down
16 changes: 14 additions & 2 deletions yal/tests/test_endline_terms_and_condition.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,21 @@ async def test_state_accept_consent_reminder(tester: AppTester, rapidpro_mock):
tester.setup_state("state_accept_consent")
await tester.user_input("I can't right now")

tester.assert_state("state_assessment_later")
tester.assert_state("state_set_reminder_timer")
tester.assert_metadata("assessment_reminder_name", "locus_of_control_endline")
tester.assert_metadata("assessment_reminder_type", "later 1hour")
tester.assert_metadata("assessment_reminder_type", "endline reengagement 30min")

message = "\n".join(
[
"🤖 No worries, we get it!",
"",
"I'll send you a reminder message in 30 mins, so you can come back"
" and answer these questions.",
"",
"Check you later 🤙🏾",
]
)
tester.assert_message(message)


@pytest.mark.asyncio
Expand Down

0 comments on commit c048fc4

Please sign in to comment.