<commit_before>module SmartAnswer
  class CalculateStatutorySickPayFlow < Flow
    def define
      start_page_content_id "1c676a9e-0424-4ebb-bab8-d8cb8d2fc6f8"
      flow_content_id "c3ecdaf0-5d37-45d0-bded-d9f1095b60d1"
      name "calculate-statutory-sick-pay"

      status :published
      satisfies_need "100262"

      # Question 1
      checkbox_question :is_your_employee_getting? do
        option :statutory_maternity_pay
        option :maternity_allowance
        option :statutory_paternity_pay
        option :statutory_adoption_pay
        option :statutory_parental_bereavement_pay
        option :shared_parental_leave_and_pay

        on_response do |response|
          self.calculator = Calculators::StatutorySickPayCalculator.new
          calculator.other_pay_types_received = response.split(",")
        end

        next_node do
          if calculator.already_getting_maternity_pay?
            outcome :already_getting_maternity
          else
            question :employee_tell_within_limit?
          end
        end
      end

      # Question 2
      multiple_choice :employee_tell_within_limit? do
        option :yes
        option :no

        on_response do |response|
          calculator.enough_notice_of_absence = response == "yes"
        end

        next_node do
          question :coronavirus_related?
        end
      end

      # Question 3
      multiple_choice :coronavirus_related? do
        option :yes
        option :no

        on_response do |response|
          calculator.coronavirus_related = response == "yes"
        end

        next_node do
          if calculator.coronavirus_related
            question :coronavirus_self_or_cohabitant?
          else
            question :employee_work_different_days?
          end
        end
      end

      # Question 3.1
      multiple_choice :coronavirus_self_or_cohabitant? do
        option :self
        option :cohabitant

        on_response do |response|
          calculator.has_coronavirus = response == "self"
          calculator.cohabitant_has_coronavirus = response == "cohabitant"
        end

        next_node do
          question :employee_work_different_days?
        end
      end

      # Question 4
      multiple_choice :employee_work_different_days? do
        option :yes
        option :no

        next_node do |response|
          case response
          when "yes"
            outcome :not_regular_schedule # Answer 4
          when "no"
            question :first_sick_day? # Question 4
          end
        end
      end

      # Question 5
      date_question :first_sick_day? do
        from { Date.new(2011, 1, 1) }
        to { Calculators::StatutorySickPayCalculator.year_of_sickness }

        on_response do |response|<commit_msg>Change order of questions so coronavirus question appears first.<commit_after>module SmartAnswer
  class CalculateStatutorySickPayFlow < Flow
    def define
      start_page_content_id "1c676a9e-0424-4ebb-bab8-d8cb8d2fc6f8"
      flow_content_id "c3ecdaf0-5d37-45d0-bded-d9f1095b60d1"
      name "calculate-statutory-sick-pay"

      status :published
      satisfies_need "100262"

      # Question 1
      checkbox_question :is_your_employee_getting? do
        option :statutory_maternity_pay
        option :maternity_allowance
        option :statutory_paternity_pay
        option :statutory_adoption_pay
        option :statutory_parental_bereavement_pay
        option :shared_parental_leave_and_pay

        on_response do |response|
          self.calculator = Calculators::StatutorySickPayCalculator.new
          calculator.other_pay_types_received = response.split(",")
        end

        next_node do
          if calculator.already_getting_maternity_pay?
            outcome :already_getting_maternity
          else
            question :coronavirus_related?
          end
        end
      end

      # Question 2
      multiple_choice :coronavirus_related? do
        option :yes
        option :no

        on_response do |response|
          calculator.coronavirus_related = response == "yes"
        end

        next_node do
          if calculator.coronavirus_related
            question :coronavirus_self_or_cohabitant?
          else
            question :employee_tell_within_limit?
          end
        end
      end

      # Question 2.1
      multiple_choice :coronavirus_self_or_cohabitant? do
        option :self
        option :cohabitant

        on_response do |response|
          calculator.has_coronavirus = response == "self"
          calculator.cohabitant_has_coronavirus = response == "cohabitant"
        end

        next_node do
          question :employee_tell_within_limit?
        end
      end

      # Question 3
      multiple_choice :employee_tell_within_limit? do
        option :yes
        option :no

        on_response do |response|
          calculator.enough_notice_of_absence = response == "yes"
        end

        next_node do
          question :employee_work_different_days?
        end
      end

      # Question 4
      multiple_choice :employee_work_different_days? do
        option :yes
        option :no

        next_node do |response|
          case response
          when "yes"
            outcome :not_regular_schedule # Answer 4
          when "no"
            question :first_sick_day? # Question 4
          end
        end
      end

      # Question 5
      date_question :first_sick_day? do
        from { Date.new(2011, 1, 1) }
        to { Calculators::StatutorySickPayCalculator.year_of_sickness }

        on_response do |response|
{'fraction_non_alphanumeric': 0.05052669166220318, 'fraction_numerical': 0.0189251919300125, 'mean_word_length': 2.078021978021978, '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': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3745596', 'n_tokens_mistral': 1769, 'n_tokens_neox': 1595, 'n_words': 351}