<commit_before>class StudentQuizzesController < ApplicationController

  def action_allowed?
    ['Administrator',
     'Instructor',
     'Teaching Assistant','Student'].include? current_role_name
  end

  def index
    @participant = AssignmentParticipant.find(params[:id])
    return unless current_user_id?(@participant.user_id)
    @assignment = Assignment.find(@participant.parent_id)
    @quiz_mappings = QuizResponseMap.get_mappings_for_reviewer(@participant.id)
  end

  def finished_quiz
    @response = Response.where(map_id: params[:map_id])
    @response_map = ResponseMap.find(params[:map_id])
    @questions = Question.where(questionnaire_id: @response_map.reviewed_object_id)

    essay_not_graded = false
    quiz_score = 0.0

    @questions.each do |question|
      score = Score.where(response_id: @response.id, question_id:  question.id).first
      if score.score.eql? -1
        essay_not_graded = true
      else
        quiz_score += score.score
      end
    end

    question_count = @questions.length

    @quiz_score = (quiz_score/question_count) * 100
    if essay_not_graded
      flash.now[:note] = "Some essay questions in this quiz have not yet been graded."
    end<commit_msg>Remove code for essay grading. #551<commit_after>class StudentQuizzesController < ApplicationController

  def action_allowed?
    ['Administrator',
     'Instructor',
     'Teaching Assistant','Student'].include? current_role_name
  end

  def index
    @participant = AssignmentParticipant.find(params[:id])
    return unless current_user_id?(@participant.user_id)
    @assignment = Assignment.find(@participant.parent_id)
    @quiz_mappings = QuizResponseMap.get_mappings_for_reviewer(@participant.id)
  end

  def finished_quiz
    @response = Response.where(map_id: params[:map_id])
    @response_map = ResponseMap.find(params[:map_id])
    @questions = Question.where(questionnaire_id: @response_map.reviewed_object_id)

    quiz_score = 0.0

    @questions.each do |question|
      score = Score.where(response_id: @response.id, question_id:  question.id).first
      if score.score.eql? -1
        #This used to be designed for ungraded essay question.
      else
        quiz_score += score.score
      end
    end

    question_count = @questions.length

    @quiz_score = (quiz_score/question_count) * 100
{'fraction_non_alphanumeric': 0.09626128061882251, 'fraction_numerical': 0.006446067898581865, 'mean_word_length': 3.8399168399168397, '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': '3861110', 'n_tokens_mistral': 764, 'n_tokens_neox': 716, 'n_words': 144}