module GradersHelper

Public Instance Methods

construct_criterion_table_row(criterion, assignment) click to toggle source

Given a criterion and an assignment, constructs a table row to be insterted into the criteria FilterTable in the graders view. Called whenever it is necessary to update the criteria table.

# File app/helpers/graders_helper.rb, line 93
def construct_criterion_table_row(criterion, assignment)
  table_row = {}

  table_row[:id] = criterion.id
  table_row[:filter_table_row_contents] =
    render_to_string :partial => 'graders/table_row/filter_table_criterion_row.html.erb',
    :locals => {:criterion => criterion, :assignment => assignment}

  table_row[:criterion_name] = criterion.get_name
  table_row[:members] = criterion.get_ta_names.to_s
  table_row[:coverage] = criterion.assigned_groups_count

  table_row
end
construct_criterion_table_rows(criteria, assignment) click to toggle source

Given a list of criteria and an assignment, constructs an array of table rows to be insterted into the criteria FilterTable in the graders view. Called whenever it is necessary to update the criteria table with multiple changes.

# File app/helpers/graders_helper.rb, line 7
def construct_criterion_table_rows(criteria, assignment)
  result = {}
  criteria.each do |criterion|
    result[criterion.id] = construct_criterion_table_row(criterion, assignment)
  end
  result
end
construct_grader_table_row(grader, assignment) click to toggle source

Given a grader and an assignment, constructs a table row to be insterted into the grader FilterTable in the graders view. Called whenever it is necessary to update the graders table.

# File app/helpers/graders_helper.rb, line 69
def construct_grader_table_row(grader, assignment)
  table_row = {}

  table_row[:id] = grader.id
  table_row[:filter_table_row_contents] =
    render_to_string :partial => 'graders/table_row/filter_table_grader_row',
    :locals => {:grader => grader}

  #These used only for searching
  table_row[:first_name] = grader.first_name
  table_row[:last_name] = grader.last_name

  #These needed for sorting
  table_row[:user_name] = grader.user_name
  table_row[:full_name] = "#{grader.first_name} #{grader.last_name}"
  table_row[:num_groups] = grader.get_membership_count_by_assignment(assignment)
  table_row[:num_criteria] = grader.get_criterion_associations_count_by_assignment(assignment)

  table_row
end
construct_grader_table_rows(graders, assignment) click to toggle source

Given a list of graders and an assignment, constructs an array of table rows to be insterted into the graders FilterTable in the graders view. Called whenever it is necessary to update the graders table with multiple changes.

# File app/helpers/graders_helper.rb, line 19
def construct_grader_table_rows(graders, assignment)
  result = {}
  graders.each do |grader|
    result[grader.id] = construct_grader_table_row(grader, assignment)
  end
  result
end
construct_table_row(grouping, assignment, total_criteria_count) click to toggle source
# File app/helpers/graders_helper.rb, line 40
def construct_table_row(grouping, assignment, total_criteria_count)
    table_row = {}

    table_row[:id] = grouping.id
    table_row[:filter_table_row_contents] =
      render_to_string :partial =>
                           'graders/table_row/filter_table_row.html.erb',
      :locals => { :grouping => grouping,
                   :assignment => assignment,
                   :total_criteria_count => total_criteria_count }

    #These are used for sorting
    table_row[:name] = grouping.group.group_name
    table_row[:members] = grouping.tas.collect{ |grader| grader.user_name}.join(',')
    table_row[:coverage] = grouping.criteria_coverage_count

    #These 2 are used for searching
    table_row[:graders] = table_row[:members]
    table_row[:grader_names] = grouping.get_ta_names.join(',')

    #This one is used for selection
    table_row[:section] = grouping.section

    table_row
end
construct_table_rows(groupings, assignment) click to toggle source

Given a list of groupings and an assignment, constructs an array of table rows to be insterted into the groupings FilterTable in the graders view. Called whenever it is necessary to update the groupings table with multiple changes.

# File app/helpers/graders_helper.rb, line 31
def construct_table_rows(groupings, assignment)
  result = {}
  total_criteria_count = assignment.criteria_count
  groupings.each do |grouping|
    result[grouping.id] = construct_table_row(grouping, assignment, total_criteria_count)
  end
  result
end