Class: Gaku::Grading::Single::Score
- Inherits:
-
BaseMethod
- Object
- BaseMethod
- Gaku::Grading::Single::Score
- Defined in:
- lib/gaku/grading/single/score.rb
Instance Attribute Summary
Attributes inherited from BaseMethod
#criteria, #gradable, #gradable_type, #result, #student
Instance Method Summary collapse
Methods inherited from BaseMethod
Constructor Details
This class inherits a constructor from Gaku::Grading::Single::BaseMethod
Instance Method Details
#grade_exam ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 |
# File 'lib/gaku/grading/single/score.rb', line 3 def grade_exam @score = nil exam = @gradable exam.exam_portions.each_with_index do |exam_portion, index| ep_score = @student.exam_portion_scores.where(exam_portion_id: exam_portion.id).first_or_create! @score = @score.to_f + ep_score.score if ep_score.score end @result = { id: @student.id, score: @score } end |