<commit_before>class SuitesController < ApplicationController
  layout "admin"

  def index
    @suites = Suite.regular.order(:name).page(params[:page])
  end

  def template
    @suites = Suite.template.order(:name).page(params[:page])
  end

  def search
    @suites = Suite.template.page(params[:page]).search(params[:q]).result
    render json: @suites.collect { |s| { id: s.id, text: s.name } }.to_json
  end

  def show
    @suite = Suite.find(params[:id])
  end

  def new
    @suite = Suite.new
  end

  def new_from_template
    template = Suite.find(params[:suite][:template_id])
    @suite   = Suite.new_from_template(template, params[:suite])

    render action: "new"
  end

  def create
    @suite = Suite.new(params[:suite])

    if @suite.save!
      flash[:success] = t(:"suites.create.success")
      redirect_to @suite
    else
      render action: "new"
    end
  end

  def edit
    @suite = Suite.find(params[:id])
  end

  def update
    @suite = Suite.find(params[:id])

    if @suite.update_attributes(params[:suite])
      flash[:success] = t(:"suites.update.success")
      redirect_to @suite
    else
      render action: "edit"
    end
  end<commit_msg>No hard failure for validation<commit_after>class SuitesController < ApplicationController
  layout "admin"

  def index
    @suites = Suite.regular.order(:name).page(params[:page])
  end

  def template
    @suites = Suite.template.order(:name).page(params[:page])
  end

  def search
    @suites = Suite.template.page(params[:page]).search(params[:q]).result
    render json: @suites.collect { |s| { id: s.id, text: s.name } }.to_json
  end

  def show
    @suite = Suite.find(params[:id])
  end

  def new
    @suite = Suite.new
  end

  def new_from_template
    template = Suite.find(params[:suite][:template_id])
    @suite   = Suite.new_from_template(template, params[:suite])

    render action: "new"
  end

  def create
    @suite = Suite.new(params[:suite])

    if @suite.save
      flash[:success] = t(:"suites.create.success")
      redirect_to @suite
    else
      render action: "new"
    end
  end

  def edit
    @suite = Suite.find(params[:id])
  end

  def update
    @suite = Suite.find(params[:id])

    if @suite.update_attributes(params[:suite])
      flash[:success] = t(:"suites.update.success")
      redirect_to @suite
    else
      render action: "edit"
    end
  end
{'fraction_non_alphanumeric': 0.13403361344537815, 'fraction_numerical': 0.0, 'mean_word_length': 3.0840480274442537, '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': '5546541', 'n_tokens_mistral': 800, 'n_tokens_neox': 775, 'n_words': 177}