components/financial_assistance/app/models/financial_assistance/applicant.rb
def embedded_document_section_entry_complete?(embedded_document) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity TODO: Remove this
      case embedded_document
      when :income
        return false if has_job_income.nil? || has_self_employment_income.nil?
        return incomes.jobs.present? && job_fields_complete && incomes.self_employment.present? && self_employment_fields_complete if has_job_income && has_self_employment_income
        return incomes.jobs.present? && job_fields_complete && incomes.self_employment.blank? if has_job_income && !has_self_employment_income
        return incomes.jobs.blank? && incomes.self_employment.present? && self_employment_fields_complete if !has_job_income && has_self_employment_income
        incomes.jobs.blank? && incomes.self_employment.blank?
      when :other_income
        if FinancialAssistanceRegistry.feature_enabled?(:unemployment_income)
          return false if has_unemployment_income.nil?
          return incomes.unemployment.first.save if incomes.unemployment.count == 1 && has_unemployment_income
          return false if has_unemployment_income.nil? || has_other_income.nil?
          return true if has_unemployment_income == false && has_other_income == false
          return true if has_unemployment_income == true && incomes.unemployment.present? && has_other_income == false
          return true if has_unemployment_income == false && has_other_income == true && incomes.other.present?
          return incomes.unemployment.present? && unemployment_fields_complete && incomes.other.present? if incomes.unemployment && incomes.other
          return incomes.unemployment.present? && unemployment_fields_complete && incomes.other.blank? if incomes.unemployment && !incomes.other
          return incomes.unemployment.blank? && unemployment_fields_complete && incomes.other.present? if !incomes.unemployment && incomes.other
          incomes.unemployment.blank? && incomes.other.blank?
          return incomes.unemployment.present? && unemployment_fields_complete if has_unemployment_income
        end
        return false if has_other_income.nil?
        return incomes.other.present? && other_income_fields_complete if has_other_income
        return incomes.other.blank? || incomes.unemployment.blank? if FinancialAssistanceRegistry.feature_enabled?(:unemployment_income)
        incomes.other.blank?
      when :income_adjustment
        return false if has_deductions.nil?
        return deductions.present? && income_adjustment_fields_complete if has_deductions
        deductions.blank?
      when :health_coverage
        return false if indian_tribe_member && health_service_through_referral.nil? && FinancialAssistanceRegistry[:indian_health_service_question].feature.is_enabled
        if FinancialAssistanceRegistry[:medicaid_chip_driver_questions].enabled?
          return false if eligible_immigration_status && medicaid_chip_ineligible.nil?
          return false if eligible_immigration_status && medicaid_chip_ineligible && immigration_status_changed.nil?
        end
        return false if indian_tribe_member && health_service_eligible.nil? && FinancialAssistanceRegistry[:indian_health_service_question].feature.is_enabled
        return medicare_eligible_qns if FinancialAssistanceRegistry.feature_enabled?(:has_medicare_cubcare_eligible)
        return dependent_coverage_questions if FinancialAssistanceRegistry.feature_enabled?(:has_dependent_with_coverage)
        return false if has_enrolled_health_coverage.nil? || has_eligible_health_coverage.nil?
        return benefits.enrolled.present? && benefits.eligible.present? && benefits.all? {|benefit| benefit.valid? :submission} if has_enrolled_health_coverage && has_eligible_health_coverage
        return benefits.enrolled.present? && benefits.enrolled.all? {|benefit| benefit.valid? :submission} && benefits.eligible.blank? if has_enrolled_health_coverage && !has_eligible_health_coverage
        return benefits.enrolled.blank? && benefits.eligible.present? && benefits.eligible.all? {|benefit| benefit.valid? :submission}  if !has_enrolled_health_coverage && has_eligible_health_coverage
        benefits.enrolled.blank? && benefits.eligible.blank?
      end
    end
# rubocop:disable Metrics/ClassLength TODO: Remove this
disable Metrics/ClassLength TODO: Remove this
disable Metrics / ClassLength TODO : Remove this
def embedded_document_section_entry_complete?(embedded_document) 
      case embedded_document
      when :income
        return false if has_job_income.nil? || has_self_employment_income.nil?
        return incomes.jobs.present? && job_fields_complete && incomes.self_employment.present? && self_employment_fields_complete if has_job_income && has_self_employment_income
        return incomes.jobs.present? && job_fields_complete && incomes.self_employment.blank? if has_job_income && !has_self_employment_income
        return incomes.jobs.blank? && incomes.self_employment.present? && self_employment_fields_complete if !has_job_income && has_self_employment_income
        incomes.jobs.blank? && incomes.self_employment.blank?
      when :other_income
        if FinancialAssistanceRegistry.feature_enabled?(:unemployment_income)
          return false if has_unemployment_income.nil?
          return incomes.unemployment.first.save if incomes.unemployment.count == 1 && has_unemployment_income
          return false if has_unemployment_income.nil? || has_other_income.nil?
          return true if has_unemployment_income == false && has_other_income == false
          return true if has_unemployment_income == true && incomes.unemployment.present? && has_other_income == false
          return true if has_unemployment_income == false && has_other_income == true && incomes.other.present?
          return incomes.unemployment.present? && unemployment_fields_complete && incomes.other.present? if incomes.unemployment && incomes.other
          return incomes.unemployment.present? && unemployment_fields_complete && incomes.other.blank? if incomes.unemployment && !incomes.other
          return incomes.unemployment.blank? && unemployment_fields_complete && incomes.other.present? if !incomes.unemployment && incomes.other
          incomes.unemployment.blank? && incomes.other.blank?
          return incomes.unemployment.present? && unemployment_fields_complete if has_unemployment_income
        end
        return false if has_other_income.nil?
        return incomes.other.present? && other_income_fields_complete if has_other_income
        return incomes.other.blank? || incomes.unemployment.blank? if FinancialAssistanceRegistry.feature_enabled?(:unemployment_income)
        incomes.other.blank?
      when :income_adjustment
        return false if has_deductions.nil?
        return deductions.present? && income_adjustment_fields_complete if has_deductions
        deductions.blank?
      when :health_coverage
        return false if indian_tribe_member && health_service_through_referral.nil? && FinancialAssistanceRegistry[:indian_health_service_question].feature.is_enabled
        if FinancialAssistanceRegistry[:medicaid_chip_driver_questions].enabled?
          return false if eligible_immigration_status && medicaid_chip_ineligible.nil?
          return false if eligible_immigration_status && medicaid_chip_ineligible && immigration_status_changed.nil?
        end
        return false if indian_tribe_member && health_service_eligible.nil? && FinancialAssistanceRegistry[:indian_health_service_question].feature.is_enabled
        return medicare_eligible_qns if FinancialAssistanceRegistry.feature_enabled?(:has_medicare_cubcare_eligible)
        return dependent_coverage_questions if FinancialAssistanceRegistry.feature_enabled?(:has_dependent_with_coverage)
        return false if has_enrolled_health_coverage.nil? || has_eligible_health_coverage.nil?
        return benefits.enrolled.present? && benefits.eligible.present? && benefits.all? {|benefit| benefit.valid? :submission} if has_enrolled_health_coverage && has_eligible_health_coverage
        return benefits.enrolled.present? && benefits.enrolled.all? {|benefit| benefit.valid? :submission} && benefits.eligible.blank? if has_enrolled_health_coverage && !has_eligible_health_coverage
        return benefits.enrolled.blank? && benefits.eligible.present? && benefits.eligible.all? {|benefit| benefit.valid? :submission}  if !has_enrolled_health_coverage && has_eligible_health_coverage
        benefits.enrolled.blank? && benefits.eligible.blank?
      end
    end
def embedded_document_section_entry_complete? ( embedded_document ) case embedded_document when :income return false if has_job_income . nil? || has_self_employment_income . nil? return incomes . jobs . present? && job_fields_complete && incomes . self_employment . present? && self_employment_fields_complete if has_job_income && has_self_employment_income return incomes . jobs . present? && job_fields_complete && incomes . self_employment . blank? if has_job_income && ! has_self_employment_income return incomes . jobs . blank? && incomes . self_employment . present? && self_employment_fields_complete if ! has_job_income && has_self_employment_income incomes . jobs . blank? && incomes . self_employment . blank? when :other_income if FinancialAssistanceRegistry . feature_enabled? ( :unemployment_income ) return false if has_unemployment_income . nil? return incomes . unemployment . first . save if incomes . unemployment . count == 1 && has_unemployment_income return false if has_unemployment_income . nil? || has_other_income . nil? return true if has_unemployment_income == false && has_other_income == false return true if has_unemployment_income == true && incomes . unemployment . present? && has_other_income == false return true if has_unemployment_income == false && has_other_income == true && incomes . other . present? return incomes . unemployment . present? && unemployment_fields_complete && incomes . other . present? if incomes . unemployment && incomes . other return incomes . unemployment . present? && unemployment_fields_complete && incomes . other . blank? if incomes . unemployment && ! incomes . other return incomes . unemployment . blank? && unemployment_fields_complete && incomes . other . present? if ! incomes . unemployment && incomes . other incomes . unemployment . blank? && incomes . other . blank? return incomes . unemployment . present? && unemployment_fields_complete if has_unemployment_income end return false if has_other_income . nil? return incomes . other . present? && other_income_fields_complete if has_other_income return incomes . other . blank? || incomes . unemployment . blank? if FinancialAssistanceRegistry . feature_enabled? ( :unemployment_income ) incomes . other . blank? when :income_adjustment return false if has_deductions . nil? return deductions . present? && income_adjustment_fields_complete if has_deductions deductions . blank? when :health_coverage return false if indian_tribe_member && health_service_through_referral . nil? && FinancialAssistanceRegistry [ :indian_health_service_question ] . feature . is_enabled if FinancialAssistanceRegistry [ :medicaid_chip_driver_questions ] . enabled? return false if eligible_immigration_status && medicaid_chip_ineligible . nil? return false if eligible_immigration_status && medicaid_chip_ineligible && immigration_status_changed . nil? end return false if indian_tribe_member && health_service_eligible . nil? && FinancialAssistanceRegistry [ :indian_health_service_question ] . feature . is_enabled return medicare_eligible_qns if FinancialAssistanceRegistry . feature_enabled? ( :has_medicare_cubcare_eligible ) return dependent_coverage_questions if FinancialAssistanceRegistry . feature_enabled? ( :has_dependent_with_coverage ) return false if has_enrolled_health_coverage . nil? || has_eligible_health_coverage . nil? return benefits . enrolled . present? && benefits . eligible . present? && benefits . all? { | benefit | benefit . valid? :submission } if has_enrolled_health_coverage && has_eligible_health_coverage return benefits . enrolled . present? && benefits . enrolled . all? { | benefit | benefit . valid? :submission } && benefits . eligible . blank? if has_enrolled_health_coverage && ! has_eligible_health_coverage return benefits . enrolled . blank? && benefits . eligible . present? && benefits . eligible . all? { | benefit | benefit . valid? :submission } if ! has_enrolled_health_coverage && has_eligible_health_coverage benefits . enrolled . blank? && benefits . eligible . blank? end end
rubocop:disable Metrics/ClassLength TODO: Remove this
rubocop : disable Metrics / ClassLength TODO : Remove this
# rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity TODO: Remove this
embedded_document