<commit_before>class Projects::BackersController < ApplicationController
  inherit_resources
  actions :index, :show, :new, :update_info, :review, :create
  skip_before_filter :force_http, only: [:create, :update_info]
  skip_before_filter :verify_authenticity_token, only: [:moip]
  load_and_authorize_resource
  belongs_to :project

  def update_info
    resource.update_attributes(params[:backer])
    render json: {message: 'updated'}
  end

  def index
    @backers = parent.backers.available_to_count.order("confirmed_at DESC").page(params[:page]).per(10)
    render @backers
  end

  def show
    @title = t('projects.backers.show.title')
    session[:thank_you_backer_id] = nil
  end

  def new
    unless parent.online?
      flash[:failure] = t('projects.back.cannot_back')
      return redirect_to :root
    end

    @create_url = ::Configuration[:secure_review_host] ?
      project_backers_url(@project, {host: ::Configuration[:secure_review_host], protocol: 'https'}) :
      project_backers_path(@project)

    @title = t('projects.backers.new.title', name: @project.name)
    @backer = @project.backers.new(user: current_user)
    empty_reward = Reward.new(minimum_value: 0, description: t('projects.backers.new.no_reward'))
    @rewards = [empty_reward] + @project.rewards.order(:minimum_value)

    # Select 
    if params[:reward_id] && (@selected_reward = @project.rewards.find params[:reward_id]) && !@selected_reward.sold_out?
      @backer.reward = @selected_reward
      @backer.value = "%0.0f" % @selected_reward.minimum_value
    end
  end

  def create
    @title = t('projects.backers.create.title')
    @backer.user = current_user
    create! do |success,failure|
      failure.html do
        flash[:failure] = t('projects.backers.review.error')
        return redirect_to new_project_backer_path(@project)
      end
      success.html do
        session[:thank_you_backer_id] = @backer.id
        return render :create
      end
    end
    @thank_you_id = @project.id
  end
<commit_msg>put back line that fixed the no reward case<commit_after>class Projects::BackersController < ApplicationController
  inherit_resources
  actions :index, :show, :new, :update_info, :review, :create
  skip_before_filter :force_http, only: [:create, :update_info]
  skip_before_filter :verify_authenticity_token, only: [:moip]
  load_and_authorize_resource
  belongs_to :project

  def update_info
    resource.update_attributes(params[:backer])
    render json: {message: 'updated'}
  end

  def index
    @backers = parent.backers.available_to_count.order("confirmed_at DESC").page(params[:page]).per(10)
    render @backers
  end

  def show
    @title = t('projects.backers.show.title')
    session[:thank_you_backer_id] = nil
  end

  def new
    unless parent.online?
      flash[:failure] = t('projects.back.cannot_back')
      return redirect_to :root
    end

    @create_url = ::Configuration[:secure_review_host] ?
      project_backers_url(@project, {host: ::Configuration[:secure_review_host], protocol: 'https'}) :
      project_backers_path(@project)

    @title = t('projects.backers.new.title', name: @project.name)
    @backer = @project.backers.new(user: current_user)
    empty_reward = Reward.new(minimum_value: 0, description: t('projects.backers.new.no_reward'))
    @rewards = [empty_reward] + @project.rewards.order(:minimum_value)

    # Select 
    if params[:reward_id] && (@selected_reward = @project.rewards.find params[:reward_id]) && !@selected_reward.sold_out?
      @backer.reward = @selected_reward
      @backer.value = "%0.0f" % @selected_reward.minimum_value
    end
  end

  def create
    @title = t('projects.backers.create.title')
    @backer.user = current_user
    @backer.reward_id = nil if params[:backer][:reward_id].to_i == 0
    create! do |success,failure|
      failure.html do
        flash[:failure] = t('projects.backers.review.error')
        return redirect_to new_project_backer_path(@project)
      end
      success.html do
        session[:thank_you_backer_id] = @backer.id
        return render :create
      end
    end
    @thank_you_id = @project.id
  end

{'fraction_non_alphanumeric': 0.11995163240628778, 'fraction_numerical': 0.002660217654171705, 'mean_word_length': 3.9592326139088727, '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': '7382937', 'n_tokens_mistral': 1391, 'n_tokens_neox': 1347, 'n_words': 257}