<commit_before>class DeploysController < ApplicationController
  before_action :load_project


  def index
    @deploys = Deploy.where(project: params[:project_id])

    @project_id = params[:project_id]
    @deploys ||= {}
  end

  def new
    @deploy = Deploy.new
  end

  def create
    deploy_name = Time.now.strftime('%Y%M%d%H%M')
    deploy_params = params[:deploy].permit(:affected_projects, :release_notes)
    deploy_params[:deploy_name] = deploy_name
    deploy_params[:date] = Date.today
    deploy_params[:start_time] = Time.now
    deploy_params[:project] = params[:project_id]
    deploy = Deploy.create(deploy_params)
    deploy.deploy_name = deploy_name

    deploy.save!

  end


  private

  def load_project
    @project = Project.find_by(identifier: params[:project_id])
  end

end
<commit_msg>Loads deploy before show and edit<commit_after>class DeploysController < ApplicationController
  before_action :load_project


  def index
    @deploys = Deploy.where(project: params[:project_id])

    @project_id = params[:project_id]
    @deploys ||= {}
  end

  def new
    @deploy = Deploy.new
  end

  def show
    load_deploy
  end

  def edit
    load_deploy
  end

  def create
    deploy_name = Time.now.strftime('%Y%M%d%H%M')
    deploy_params = params[:deploy].permit(:affected_projects, :release_notes)
    deploy_params[:deploy_name] = deploy_name
    deploy_params[:date] = Date.today
    deploy_params[:start_time] = Time.now
    deploy_params[:project] = params[:project_id]
    deploy = Deploy.create(deploy_params)
    deploy.deploy_name = deploy_name

    deploy.save!

  end


  private

  def load_deploy
    @deploy = Deploy.find_by_id(params[:id])
    @project_issues = @project.issues
  end

  def load_project
    @project = Project.find_by(identifier: params[:project_id])
  end

end

{'fraction_non_alphanumeric': 0.10307017543859649, 'fraction_numerical': 0.0, 'mean_word_length': 3.828042328042328, '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': '2121734', 'n_tokens_mistral': 640, 'n_tokens_neox': 594, 'n_words': 116}