<commit_before># Manages actions relating to assigning graders.
class MarksGradersController < ApplicationController
  before_action { authorize! }

  layout 'assignment_content'

  def index
    respond_to do |format|
      format.html { @grade_entry_form = GradeEntryForm.find(params[:grade_entry_form_id]) }
      format.json do
        gef = GradeEntryForm.find(params[:grade_entry_form_id])

        # Grader information
        counts = Ta.joins(:grade_entry_students)
                   .where('grade_entry_students.assessment_id': gef.id)
                   .group('roles.id')
                   .count

        graders = current_course.tas.joins(:human).pluck('roles.id', :user_name, :first_name, :last_name).map do |ta_data|
          {
            _id: ta_data[0],
            user_name: ta_data[1],
            first_name: ta_data[2],
            last_name: ta_data[3],
            students: counts[ta_data[0]] || 0
          }
        end

        # Student information
        student_data = gef.grade_entry_students
                          .left_outer_joins(role: :human, tas: :human)
                          .pluck('roles.id',
                                 'users.user_name',
                                 'users.first_name',
                                 'users.last_name',
                                 'humen_roles.user_name') # Note: Rails pluralizes human as humen here

        students = Hash.new { |h, k| h[k] = [] }
        student_data.each do |s0, s1, s2, s3, ta|
          students[[s0, s1, s2, s3]] # Touch to set default value
          unless ta.nil?
            students[[s0, s1, s2, s3]] << ta
          end
        end
        section_data = current_course.students.joins(:section).pluck('roles.id', 'sections.name').to_h
        students = students.map do |k, v|
          {
            _id: k[0],
            user_name: k[1],<commit_msg>style: update style [ci skip]<commit_after># Manages actions relating to assigning graders.
class MarksGradersController < ApplicationController
  before_action { authorize! }

  layout 'assignment_content'

  def index
    respond_to do |format|
      format.html { @grade_entry_form = GradeEntryForm.find(params[:grade_entry_form_id]) }
      format.json do
        gef = GradeEntryForm.find(params[:grade_entry_form_id])

        # Grader information
        counts = Ta.joins(:grade_entry_students)
                   .where('grade_entry_students.assessment_id': gef.id)
                   .group('roles.id')
                   .count

        graders = current_course.tas
                                .joins(:human)
                                .pluck('roles.id', :user_name, :first_name, :last_name)
                                .map do |ta_data|
          {
            _id: ta_data[0],
            user_name: ta_data[1],
            first_name: ta_data[2],
            last_name: ta_data[3],
            students: counts[ta_data[0]] || 0
          }
        end

        # Student information
        student_data = gef.grade_entry_students
                          .left_outer_joins(role: :human, tas: :human)
                          .pluck('roles.id',
                                 'users.user_name',
                                 'users.first_name',
                                 'users.last_name',
                                 'humen_roles.user_name') # Note: Rails pluralizes human as humen here

        students = Hash.new { |h, k| h[k] = [] }
        student_data.each do |s0, s1, s2, s3, ta|
          students[[s0, s1, s2, s3]] # Touch to set default value
          unless ta.nil?
            students[[s0, s1, s2, s3]] << ta
          end
        end
        section_data = current_course.students.joins(:section).pluck('roles.id', 'sections.name').to_h
        students = students.map do |k, v|
          {
            _id: k[0],
            user_name: k[1],
{'fraction_non_alphanumeric': 0.10506036475725661, 'fraction_numerical': 0.010274852298998202, 'mean_word_length': 1.6029411764705883, 'pattern_counts': {'":': 0, '<': 9, '<?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': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4728767', 'n_tokens_mistral': 1171, 'n_tokens_neox': 1153, 'n_words': 236}