<commit_before>class QuizzesController < ApplicationController

  before_filter :require_instructor, :except => :show
  before_filter :get_course, :except => :parse_date

  def index
    @quizzes = @course.quizzes
  end

  def mark_viewable
    @quiz = @course.quizzes.find params[:id]
    @quiz.update_attribute :viewable_at, Time.now

    redirect_to :action => :index
  end

  def show
    @quiz = @course.quizzes.find(params[:id])
    @question_responses = current_user.question_responses.find_all_by_quiz_id @quiz
  end

  def new
    @quiz = Quiz.new
  end

  def edit
    @quiz = @course.quizzes.find(params[:id])
    @questions = Question.find_by_contents("*", { :limit => :all }, :include => :choices)
  end

  def create
    @quiz = @course.quizzes.build params[:quiz]

    if @quiz.save
      flash[:notice] = 'Quiz successfully created.'
      redirect_to course_quizzes_path(@course)
    else
      flash[:error] = 'Quiz not saved.'
      render :action => "new"
    end
  end

  def update
    @quiz = @course.quizzes.find(params[:id])

    if @quiz.update_attributes(params[:quiz])
      flash[:notice] = 'Quiz successfully updated.'
      redirect_to course_quizzes_path(@course)
    else
      @questions = Question.find :all, :include => :choices
      render :action => "edit"
    end
  end

  def destroy
    @quiz = @course.quizzes.find(params[:id])
    @quiz.destroy

    flash[:notice] = 'Quiz successfuly deleted.'
    redirect_to course_quizzes_path(@course)
  end
end<commit_msg>go straight to quiz/edit after creating a quiz<commit_after>class QuizzesController < ApplicationController

  before_filter :require_instructor, :except => :show
  before_filter :get_course, :except => :parse_date

  def index
    @quizzes = @course.quizzes
  end

  def mark_viewable
    @quiz = @course.quizzes.find params[:id]
    @quiz.update_attribute :viewable_at, Time.now

    redirect_to :action => :index
  end

  def show
    @quiz = @course.quizzes.find(params[:id])
    @question_responses = current_user.question_responses.find_all_by_quiz_id @quiz
  end

  def new
    @quiz = Quiz.new
  end

  def edit
    @quiz = @course.quizzes.find(params[:id])
    @questions = Question.find_by_contents("*", { :limit => :all }, :include => :choices)
  end

  def create
    @quiz = @course.quizzes.build params[:quiz]

    if @quiz.save
      flash[:notice] = 'Quiz successfully created.'
      redirect_to edit_course_quiz_path(@course, @quiz)
    else
      flash[:error] = 'Quiz not saved.'
      render :action => "new"
    end
  end

  def update
    @quiz = @course.quizzes.find(params[:id])

    if @quiz.update_attributes(params[:quiz])
      flash[:notice] = 'Quiz successfully updated.'
      redirect_to course_quizzes_path(@course)
    else
      @questions = Question.find :all, :include => :choices
      render :action => "edit"
    end
  end

  def destroy
    @quiz = @course.quizzes.find(params[:id])
    @quiz.destroy

    flash[:notice] = 'Quiz successfuly deleted.'
    redirect_to course_quizzes_path(@course)
  end
end
{'fraction_non_alphanumeric': 0.11893840104849279, 'fraction_numerical': 0.0, 'mean_word_length': 3.3739255014326646, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 19, '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': '5091765', 'n_tokens_mistral': 1067, 'n_tokens_neox': 1034, 'n_words': 229}