<commit_before>class ProjectsController < ApplicationController
  before_filter :require_login, :only => [:edit, :publish_review, :publish,
                                          :destroy, :contribute, :unpublish]

  include ActionView::Helpers::NumberHelper

  def index
    if params[:user]
      # username search
      @user = User.find(params[:user])
      if @user
        @projects = Project.where(:user_id => @user.id)
      else
        flash[:error] = "No user #{params[:user]}"
        redirect_to root_path
      end
    else
      @projects = Project.fundables.limit(10).order(:funding_due)
    end
  end

  def new
    if logged_in?
      @project = current_user.projects.build
      @project.funding_due = 1.week.from_now
    else
      flash[:error] = "Login first"
      redirect_to :root
    end
  end

  def create
    if logged_in?
      params[:project][:funding_due] += " #{params[:timezone]}"
      params[:project][:payment_gateway] = SETTINGS.default_payment_gateway
      project = current_user.projects.create(params[:project])
      if project.valid?<commit_msg>wording tweak<commit_after>class ProjectsController < ApplicationController
  before_filter :require_login, :only => [:edit, :publish_review, :publish,
                                          :destroy, :contribute, :unpublish]

  include ActionView::Helpers::NumberHelper

  def index
    if params[:user]
      # username search
      @user = User.find(params[:user])
      if @user
        @projects = Project.where(:user_id => @user.id)
      else
        flash[:error] = "No user #{params[:user]}"
        redirect_to root_path
      end
    else
      @projects = Project.fundables.limit(10).order(:funding_due)
    end
  end

  def new
    if logged_in?
      @project = current_user.projects.build
      @project.funding_due = 1.week.from_now
    else
      flash[:error] = "Please sign in to begin creating your funding project."
      redirect_to :root
    end
  end

  def create
    if logged_in?
      params[:project][:funding_due] += " #{params[:timezone]}"
      params[:project][:payment_gateway] = SETTINGS.default_payment_gateway
      project = current_user.projects.create(params[:project])
      if project.valid?
{'fraction_non_alphanumeric': 0.11081202332884701, 'fraction_numerical': 0.0026917900403768506, 'mean_word_length': 2.7416107382550337, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4108880', 'n_tokens_mistral': 661, 'n_tokens_neox': 647, 'n_words': 143}