Sha256: 83c21242d8b6f93a9529f7d6f817a1f542deb13f953bb4f567558cc3a2060dd7
Contents?: true
Size: 1.1 KB
Versions: 6
Compression:
Stored size: 1.1 KB
Contents
module Gaku module Grading module Collection class Calculations attr_reader :grading_methods, :students, :exam, :gradable_scope def initialize(grading_method, students, exam, gradable_scope) @exam = exam @students = students @grading_methods = grading_method @gradable_scope = gradable_scope end def calculate {}.tap do |hash| @grading_methods.each do |grading_method| grading = grading_types[grading_method.grading_type].constantize.new(@exam, @students, gradable_scope, grading_method.criteria) hash[grading_method.id] = grading.grade end end end private def grading_types ActiveSupport::HashWithIndifferentAccess.new( score: 'Gaku::Grading::Collection::Score', percentage: 'Gaku::Grading::Collection::Percentage', ordinal: 'Gaku::Grading::Collection::Ordinal', interval: 'Gaku::Grading::Collection::Interval' ) end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems