Sha256: ea387b39bf8f60308886362c0b88c8e07d4f66a6f10635aa785491f94220cd12

Contents?: true

Size: 426 Bytes

Versions: 10

Compression:

Stored size: 426 Bytes

Contents

class Gaku::Grading::Single::Score < Gaku::Grading::Single::BaseMethod

  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

end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
gaku-0.2.4 core/lib/gaku/grading/single/score.rb
gaku_core-0.2.4 lib/gaku/grading/single/score.rb
gaku-0.2.3 core/lib/gaku/grading/single/score.rb
gaku_core-0.2.3 lib/gaku/grading/single/score.rb
gaku-0.2.2 core/lib/gaku/grading/single/score.rb
gaku_core-0.2.2 lib/gaku/grading/single/score.rb
gaku-0.2.1 core/lib/gaku/grading/single/score.rb
gaku_core-0.2.1 lib/gaku/grading/single/score.rb
gaku-0.2.0 core/lib/gaku/grading/single/score.rb
gaku_core-0.2.0 lib/gaku/grading/single/score.rb