<commit_before>class PensionSummariesController < ApplicationController
  layout 'guides'

  before_action :set_summary
  before_action :set_breadcrumbs

  def start
    @guide = get_guide('start')
  end

  def step_one
    @guide = get_guide('step-one')
  end

  def step_two
    @guide = get_guide('step-two')
  end

  def summary
    @guide = get_guide(@summary.current_step)
  end

  def print
    @intro = get_guide('print-introduction')
    @guides = @summary.selected_steps.collect { |s| get_guide(s) }

    render 'pension_summaries/print', layout: false
  end

  def download
    @intro = get_guide('print-introduction')
    @guides = @summary.selected_steps.collect { |s| get_guide(s) }

    render pdf: 'your pension summary from Pension Wise',
           template: 'pension_summaries/print',
           handlers: %w(erb),
           formats: %w(html),
           layout: false,
           disposition: 'inline'
  end

  private

  def get_guide(slug)
    GuideDecorator.cached_for(GuideRepository.new.find("pension_summary/#{slug}"))
  end

  PENSION_SUMMARY_PARAMS = [
    *PensionSummary::OPTIONS,
    :current_step
  ].freeze

  def summary_params
    params
      .fetch(:pension_summary, {})
      .permit(PENSION_SUMMARY_PARAMS)
  end

  def set_summary
    @summary = PensionSummary.new(summary_params)
  end

  def set_breadcrumbs
    breadcrumb Breadcrumb.build_your_pensions_summary if params[:action] != 'start'
    breadcrumb Breadcrumb.explore_your_options_step_one if %w(start step_one).exclude?(params[:action])
  end

  def alternate_url(new_locale, options = {})
    new_params = params.permit(:id, :locale, pension_summary: PENSION_SUMMARY_PARAMS)
    new_params.merge!(options)
    new_params[:locale] = new_locale

    url_for(new_params)
  end

  def skip_to_step_path(step)
    new_params = summary_params.merge(current_step: step)<commit_msg>Disable missing translation notice for self serve journey<commit_after>class PensionSummariesController < ApplicationController
  layout 'guides'

  before_action :set_summary
  before_action :set_breadcrumbs

  def start
    @guide = get_guide('start')
  end

  def step_one
    @guide = get_guide('step-one')
  end

  def step_two
    @guide = get_guide('step-two')
  end

  def summary
    @guide = get_guide(@summary.current_step)
  end

  def print
    @intro = get_guide('print-introduction')
    @guides = @summary.selected_steps.collect { |s| get_guide(s) }

    render 'pension_summaries/print', layout: false
  end

  def download
    @intro = get_guide('print-introduction')
    @guides = @summary.selected_steps.collect { |s| get_guide(s) }

    render pdf: 'your pension summary from Pension Wise',
           template: 'pension_summaries/print',
           handlers: %w(erb),
           formats: %w(html),
           layout: false,
           disposition: 'inline'
  end

  private

  def get_guide(slug)
    GuideDecorator.cached_for(GuideRepository.new.find("pension_summary/#{slug}"))
  end

  PENSION_SUMMARY_PARAMS = [
    *PensionSummary::OPTIONS,
    :current_step
  ].freeze

  def summary_params
    params
      .fetch(:pension_summary, {})
      .permit(PENSION_SUMMARY_PARAMS)
  end

  def set_summary
    @summary = PensionSummary.new(summary_params)
  end

  def set_breadcrumbs
    breadcrumb Breadcrumb.build_your_pensions_summary if params[:action] != 'start'
    breadcrumb Breadcrumb.explore_your_options_step_one if %w(start step_one).exclude?(params[:action])
  end

  def alternate_url(new_locale, options = {})
    new_params = params.permit(:id, :locale, pension_summary: PENSION_SUMMARY_PARAMS)
    new_params.merge!(options)
    new_params[:locale] = new_locale

    url_for(new_params)
  end

  def content_lang_matches_locale?
    true
  end

  def skip_to_step_path(step)
    new_params = summary_params.merge(current_step: step)
{'fraction_non_alphanumeric': 0.09846713432060275, 'fraction_numerical': 0.0, 'mean_word_length': 3.7123623011015914, '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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '970381', 'n_tokens_mistral': 1352, 'n_tokens_neox': 1273, 'n_words': 250}