app/helpers/review_mapping_helper.rb
# This function computes the average number of suggestions per round of an assignment, across all the reviewers.
This function computes the average number of suggestions per round of an assignment, across all the reviewers.
This function computes the average number of suggestions per round of an assignment across all the reviewers .
def avg_num_suggestions_per_round(assignment_id, round_id, type)
	scores = 0
	avg_score = 0
	reviewers = nil;
  if @reviewers
		reviewers = @reviewers;
	else
		reviewers = AssignmentParticipant.where(parent_id: assignment_id)
	end
	reviewers.each do |r|
		response_maps = ResponseMap.where(["reviewed_object_id = ? AND reviewer_id = ? AND type = ?", assignment_id, r.id, type])
		score = num_suggestions_per_student_per_round(response_maps,round_id)
		scores += score
  end
  avg_score = (scores/reviewers.length).ceil() unless reviewers.empty?
	return avg_score
  end
def avg_num_suggestions_per_round ( assignment_id , round_id , type ) scores = 0 avg_score = 0 reviewers = nil ; if @reviewers reviewers = @reviewers ; else reviewers = AssignmentParticipant . where ( parent_id : assignment_id ) end reviewers . each do | r | response_maps = ResponseMap . where ( [ "reviewed_object_id = ? AND reviewer_id = ? AND type = ?" , assignment_id , r . id , type ] ) score = num_suggestions_per_student_per_round ( response_maps , round_id ) scores += score end avg_score = ( scores / reviewers . length ) . ceil ( ) unless reviewers . empty? return avg_score end
This function computes the average number of suggestions per round of an assignment, across all the reviewers.
This function computes the average number of suggestions per round of an assignment across all the reviewers .
#compute average across all reviewers' suggestion scores
assignment_id
round_id
type