<commit_before>class QuestionsController < ApplicationController

  before_action :authenticate_user!, only: [:new, :create, :edit, :update, :destroy]
  before_action :set_question, only: [:show, :edit, :update, :destroy]

  respond_to :html, :json

  def index
    @questions = Question.all
  end

  def show
    @question = Question.find(params[:id])
  end

  def new
    @question = Question.new
  end

  def edit
    
  end

  def create
    @user = current_user
    @question = @user.questions.new(question_params)
    if @question.save
      respond_to do |format|
        format.html do
          flash[:notice] = "Question successfully added."
          redirect_to questions_path<commit_msg>creating question costs 10 pts<commit_after>class QuestionsController < ApplicationController

  before_action :authenticate_user!, only: [:new, :create, :edit, :update, :destroy]
  before_action :set_question, only: [:show, :edit, :update, :destroy]

  respond_to :html, :json

  def index
    @questions = Question.all
  end

  def show
    @question = Question.find(params[:id])
  end

  def new
    @question = Question.new
  end

  def edit
    
  end

  def create
    @user = current_user
    @question = @user.questions.new(question_params)
    @question.user.points -= 10
    if @question.save
      @question.user.save
      respond_to do |format|
        format.html do
          flash[:notice] = "Question successfully added."
          redirect_to questions_path
{'fraction_non_alphanumeric': 0.09898305084745762, 'fraction_numerical': 0.002711864406779661, 'mean_word_length': 3.146067415730337, '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': '1674697', 'n_tokens_mistral': 465, 'n_tokens_neox': 438, 'n_words': 122}