app/models/participant.rb
# Return scores that this participant for the given questions
Return scores that this participant for the given questions
Return scores that this participant for the given questions
def scores(questions)
    scores = {}
    scores[:participant] = self
    if self.assignment.varying_rubrics_by_round? 
      self.assignment.questionnaires.each do |questionnaire|
        round = AssignmentQuestionnaire.find_by(assignment_id: self.assignment.id, questionnaire_id: questionnaire.id).used_in_round
        questionnaire_symbol = if !round.nil?
                                 (questionnaire.symbol.to_s + round.to_s).to_sym
                               else
                                 questionnaire.symbol
                               end
        scores[questionnaire_symbol] = {}
        scores[questionnaire_symbol][:assessments] = questionnaire.get_assessments_for(self)
        scores[questionnaire_symbol][:scores] = Answer.compute_scores(scores[questionnaire_symbol][:assessments], questions[questionnaire_symbol])
      end
    else 
      self.assignment.questionnaires.each do |questionnaire|
        scores[questionnaire.symbol] = {}
        scores[questionnaire.symbol][:assessments] = questionnaire.get_assessments_for(self)
        scores[questionnaire.symbol][:scores] = Answer.compute_scores(scores[questionnaire.symbol][:assessments], questions[questionnaire.symbol])
      end
    end
    scores[:total_score] = assignment.compute_total_score(scores)
    scores
  end
def scores ( questions ) scores = { } scores [ :participant ] = self if self . assignment . varying_rubrics_by_round? self . assignment . questionnaires . each do | questionnaire | round = AssignmentQuestionnaire . find_by ( assignment_id : self . assignment . id , questionnaire_id : questionnaire . id ) . used_in_round questionnaire_symbol = if ! round . nil? ( questionnaire . symbol . to_s + round . to_s ) . to_sym else questionnaire . symbol end scores [ questionnaire_symbol ] = { } scores [ questionnaire_symbol ] [ :assessments ] = questionnaire . get_assessments_for ( self ) scores [ questionnaire_symbol ] [ :scores ] = Answer . compute_scores ( scores [ questionnaire_symbol ] [ :assessments ] , questions [ questionnaire_symbol ] ) end else self . assignment . questionnaires . each do | questionnaire | scores [ questionnaire . symbol ] = { } scores [ questionnaire . symbol ] [ :assessments ] = questionnaire . get_assessments_for ( self ) scores [ questionnaire . symbol ] [ :scores ] = Answer . compute_scores ( scores [ questionnaire . symbol ] [ :assessments ] , questions [ questionnaire . symbol ] ) end end scores [ :total_score ] = assignment . compute_total_score ( scores ) scores end
Return scores that this participant for the given questions
Return scores that this participant for the given questions
# for "vary rubric by rounds" feature -Yang # not using "vary rubric by rounds" feature
questions