<commit_before>class ParticipationsController < ApplicationController
  def new
    @decision = Decision.find(params[:decision_id])
    @participation = Participation.new
    @participations = @decision.participations
  end

  def create
    user = User.find_by_email(params[:participation][:user])
    # participation = Participation.find_by(user_id: user.id)

    # puts participation.validate

    @decision = Decision.find(params[:decision_id])

    if user
     if !user.decisions.include? @decision
        QueryService.add_user(@decision, user)
        redirect_to new_decision_participation_path(@decision)
      else
        flash[:error] = "You already added that friend!"
        redirect_to new_decision_participation_path(@decision)
      end
    else
      flash[:error] = "User not found! Please try again."
      redirect_to new_decision_participation_path(@decision)
    end
  end
end<commit_msg>add downcase to friend find<commit_after>class ParticipationsController < ApplicationController
  def new
    @decision = Decision.find(params[:decision_id])
    @participation = Participation.new
    @participations = @decision.participations
  end

  def create
    user = User.find_by_email(params[:participation][:user].downcase)
    @decision = Decision.find(params[:decision_id])

    if user
     if !user.decisions.include? @decision
        QueryService.add_user(@decision, user)
        redirect_to new_decision_participation_path(@decision)
      else
        flash[:error] = "You already added that friend!"
        redirect_to new_decision_participation_path(@decision)
      end
    else
      flash[:error] = "User not found! Please try again."
      redirect_to new_decision_participation_path(@decision)
    end

  end
end
{'fraction_non_alphanumeric': 0.0867579908675799, 'fraction_numerical': 0.0, 'mean_word_length': 3.789617486338798, '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': '5440933', 'n_tokens_mistral': 531, 'n_tokens_neox': 479, 'n_words': 108}