diff --git a/yal/endline_terms_and_conditions.py b/yal/endline_terms_and_conditions.py index d6a33167..73c95714 100644 --- a/yal/endline_terms_and_conditions.py +++ b/yal/endline_terms_and_conditions.py @@ -222,7 +222,7 @@ async def state_household_number_of_people(self): " Don’t forget to include babies.*", "", "(If you’re unsure - this counts as anyone sleeping the house" - "4 nights in the past week).", + " 4 nights in the past week).", ] ) ) @@ -237,17 +237,17 @@ async def state_household_number_of_people(self): ) ) - next = "state_submit_terms_and_conditions_endline" - - if choices[0].value == "eight_more": - next = "state_household_number_of_people_more" + async def next_state(choice: Choice): + if choice.value == "eight_more": + return "state_household_number_of_people_more" + return "state_submit_terms_and_conditions_endline" return WhatsAppListState( self, question=question, error=error, choices=choices, - next=next, + next=next_state, button="Choose Option", ) diff --git a/yal/tests/test_endline_terms_and_condition.py b/yal/tests/test_endline_terms_and_condition.py index 4a12c81f..f3d6451c 100644 --- a/yal/tests/test_endline_terms_and_condition.py +++ b/yal/tests/test_endline_terms_and_condition.py @@ -86,7 +86,7 @@ async def test_state_monthly_household_income_endline(tester: AppTester, rapidpr " Don’t forget to include babies.*", "", "(If you’re unsure - this counts as anyone sleeping the house" - "4 nights in the past week).", + " 4 nights in the past week).", ] ) tester.assert_message(message)