<commit_before>module SmartAnswer
  class PayLeaveForParentsFlow < Flow
    def define
      name "pay-leave-for-parents"
      status :published
      satisfies_need "101018"

      multiple_choice :two_carers do
        option "yes"
        option "no"

        save_input_as :two_carers

        next_node_calculation :calculator do
          Calculators::PayLeaveForParentsCalculator.new
        end

        next_node :due_date
      end

      date_question :due_date do
        save_input_as :due_date

        next_node :employment_status_of_mother
      end

      multiple_choice :employment_status_of_mother do
        option "employee"
        option "worker"
        option "self-employed"
        option "unemployed"

        save_input_as :employment_status_of_mother

        permitted_next_nodes = [
          :mother_started_working_before_continuity_start_date,
          :mother_worked_at_least_26_weeks,
          :employment_status_of_partner
        ]
        next_node(permitted: permitted_next_nodes) do |response|
          if two_carers == 'no'
            case response
            when 'employee', 'worker'
              :mother_started_working_before_continuity_start_date
            when 'self-employed', 'unemployed'
              :mother_worked_at_least_26_weeks
            end
          elsif two_carers == 'yes'
            :employment_status_of_partner
          end
        end
      end

      multiple_choice :employment_status_of_partner do
        option "employee"
        option "worker"
        option "self-employed"
        option "unemployed"

        save_input_as :employment_status_of_partner

        next_node do |response|
          case employment_status_of_mother
          when 'employee', 'worker'
            :mother_started_working_before_continuity_start_date
          when 'self-employed', 'unemployed'
            :mother_worked_at_least_26_weeks
          end
        end
      end<commit_msg>Add permitted next nodes for employment_status_of_partner<commit_after>module SmartAnswer
  class PayLeaveForParentsFlow < Flow
    def define
      name "pay-leave-for-parents"
      status :published
      satisfies_need "101018"

      multiple_choice :two_carers do
        option "yes"
        option "no"

        save_input_as :two_carers

        next_node_calculation :calculator do
          Calculators::PayLeaveForParentsCalculator.new
        end

        next_node :due_date
      end

      date_question :due_date do
        save_input_as :due_date

        next_node :employment_status_of_mother
      end

      multiple_choice :employment_status_of_mother do
        option "employee"
        option "worker"
        option "self-employed"
        option "unemployed"

        save_input_as :employment_status_of_mother

        permitted_next_nodes = [
          :mother_started_working_before_continuity_start_date,
          :mother_worked_at_least_26_weeks,
          :employment_status_of_partner
        ]
        next_node(permitted: permitted_next_nodes) do |response|
          if two_carers == 'no'
            case response
            when 'employee', 'worker'
              :mother_started_working_before_continuity_start_date
            when 'self-employed', 'unemployed'
              :mother_worked_at_least_26_weeks
            end
          elsif two_carers == 'yes'
            :employment_status_of_partner
          end
        end
      end

      multiple_choice :employment_status_of_partner do
        option "employee"
        option "worker"
        option "self-employed"
        option "unemployed"

        save_input_as :employment_status_of_partner

        permitted_next_nodes = [
          :mother_started_working_before_continuity_start_date,
          :mother_worked_at_least_26_weeks
        ]
        next_node(permitted: permitted_next_nodes) do |response|
          case employment_status_of_mother
          when 'employee', 'worker'
            :mother_started_working_before_continuity_start_date
          when 'self-employed', 'unemployed'
            :mother_worked_at_least_26_weeks
          end
        end
      end
{'fraction_non_alphanumeric': 0.04945717732207479, 'fraction_numerical': 0.006272617611580217, 'mean_word_length': 2.2164468580294803, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6030519', 'n_tokens_mistral': 1254, 'n_tokens_neox': 1147, 'n_words': 226}