diff --git a/yal/surveys/location.py b/yal/surveys/location.py index 3f08d534..69fec906 100644 --- a/yal/surveys/location.py +++ b/yal/surveys/location.py @@ -98,13 +98,22 @@ async def state_location_introduction(self): ) async def state_location_not_invited(self): - return EndState( + question = self._( + "Unfortunately it looks like we already have enough people answering this " + "survey, but thank you for your interest." + ) + return WhatsAppButtonState( self, - self._( - "Unfortunately it looks like we already have enough people answering " - "this survey, but thank you for your interest." - ), - next=self.START_STATE, + question=question, + choices=[ + Choice("menu", self._("Go to the menu")), + Choice("aaq", self._("Ask a question")), + ], + next={ + "menu": "state_pre_mainmenu", + "aaq": AAQApplication.START_STATE, + }, + error=self._(get_generic_error()), ) async def state_location_invalid_province(self): @@ -124,10 +133,19 @@ async def state_location_invalid_province(self): ) async def state_location_already_completed(self): - return EndState( + question = self._("This number has already completed the location survey.") + return WhatsAppButtonState( self, - self._("This number has already completed the location survey."), - next=self.START_STATE, + question=question, + choices=[ + Choice("menu", self._("Go to the menu")), + Choice("aaq", self._("Ask a question")), + ], + next={ + "menu": "state_pre_mainmenu", + "aaq": AAQApplication.START_STATE, + }, + error=self._(get_generic_error()), ) async def state_location_decline(self): diff --git a/yal/tests/states_dictionary.md b/yal/tests/states_dictionary.md index 6869ecd4..5b7e0b63 100644 --- a/yal/tests/states_dictionary.md +++ b/yal/tests/states_dictionary.md @@ -760,8 +760,8 @@ | state_name | accepts_user_input | data_type | description | | ---------- | ------------------ | --------- | ----------- | | state_location_introduction | TRUE | Text | Surveu introduction -| state_location_not_invited | FALSE | Text | Tells user they weren't invited to the study -| state_location_already_completed | FALSE | Text | Tells user they already completed the study +| state_location_not_invited | TRUE | Text | Tells user they weren't invited to the study +| state_location_already_completed | TRUE | Text | Tells user they already completed the study | state_location_province | TRUE | Text | Ask user which province they live in | state_location_not_recruiting | FALSE | Text | Tells user we're not recruiting in the province they live in | state_location_name_city | TRUE | Text | Ask user the name of the city they live in diff --git a/yal/tests/surveys/test_location.py b/yal/tests/surveys/test_location.py index f8762583..949612c4 100644 --- a/yal/tests/surveys/test_location.py +++ b/yal/tests/surveys/test_location.py @@ -97,7 +97,7 @@ async def test_state_location_introduction_already_completed(tester: AppTester): await tester.user_input(session=Message.SESSION_EVENT.NEW) - tester.assert_state("state_start") + tester.assert_state("state_location_already_completed") tester.assert_message("This number has already completed the location survey.") @@ -129,7 +129,7 @@ async def test_state_location_introduction_not_invited(tester: AppTester): tester.setup_state("state_location_introduction") await tester.user_input(session=Message.SESSION_EVENT.NEW) - tester.assert_state("state_start") + tester.assert_state("state_location_not_invited") tester.assert_message( "Unfortunately it looks like we already have enough people answering this " @@ -143,7 +143,7 @@ async def test_state_location_introduction_group_max(tester: AppTester): tester.setup_state("state_location_introduction") await tester.user_input(session=Message.SESSION_EVENT.NEW) - tester.assert_state("state_start") + tester.assert_state("state_location_not_invited") tester.assert_message( "Unfortunately it looks like we already have enough people answering this "