<commit_before>class Deferred::ConfirmationsController < ApplicationController
  helper_method :booked_visit
  permit_only_from_prisons

  def new
    reset_session if params[:state]
    @confirmation = Confirmation.new
    metrics_logger.record_link_click(booked_visit)
    if metrics_logger.processed?(booked_visit)
      reset_session
      render '_already_booked'
    end
    logstasher_add_visit_id(booked_visit.visit_id)
  rescue ActiveSupport::MessageVerifier::InvalidSignature => e
    render '_bad_state', status: 400
    Raven.capture_exception(e)
  end

  def create
    unless (@confirmation = Confirmation.new(confirmation_params)).valid?
      render :new
      return
    end

    if @confirmation.slot_selected?
      VisitorMailer.booking_confirmation_email(booked_visit, @confirmation).deliver
      metrics_logger.record_booking_confirmation(booked_visit)
    else
      VisitorMailer.booking_rejection_email(booked_visit, @confirmation).deliver
      metrics_logger.record_booking_rejection(booked_visit, @confirmation.outcome)
    end<commit_msg>Accept processing form submission when no fields selected<commit_after>class Deferred::ConfirmationsController < ApplicationController
  helper_method :booked_visit
  permit_only_from_prisons

  def new
    reset_session if params[:state]
    @confirmation = Confirmation.new
    metrics_logger.record_link_click(booked_visit)
    if metrics_logger.processed?(booked_visit)
      reset_session
      render '_already_booked'
    end
    logstasher_add_visit_id(booked_visit.visit_id)
  rescue ActiveSupport::MessageVerifier::InvalidSignature => e
    render '_bad_state', status: 400
    Raven.capture_exception(e)
  end

  def create
   unless params[:confirmation] && (@confirmation = Confirmation.new(confirmation_params)).valid?
      @confirmation ||= Confirmation.new
      render :new
      return
    end

    if @confirmation.slot_selected?
      VisitorMailer.booking_confirmation_email(booked_visit, @confirmation).deliver
      metrics_logger.record_booking_confirmation(booked_visit)
    else
      VisitorMailer.booking_rejection_email(booked_visit, @confirmation).deliver
      metrics_logger.record_booking_rejection(booked_visit, @confirmation.outcome)
    end
{'fraction_non_alphanumeric': 0.06859688195991091, 'fraction_numerical': 0.0026726057906458797, 'mean_word_length': 4.833766233766234, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '6434503', 'n_tokens_mistral': 684, 'n_tokens_neox': 669, 'n_words': 109}