Sha256: f24def5db7f3d961f481cdce498227f0a8a874702b944337188b5d3947123e9a

Contents?: true

Size: 667 Bytes

Versions: 16

Compression:

Stored size: 667 Bytes

Contents

module Gaku
  class GradingMethod < ActiveRecord::Base
    has_one :exam
    has_one :exam_portion
    has_one :assignment
    has_many :simple_grade_types

    has_many :grading_method_connectors

    has_many :grading_method_set_items
    has_many :grading_method_sets, through: :grading_method_set_items

    validates :name, presence: true, uniqueness: true

    Types = %w( score percentage ordinal interval )

    validates :grading_type, presence: true, inclusion: { in: Types }

    serialize :criteria, Hash

    Types.each do |type|
      define_method "#{type}?" do
        grading_type == type
      end
    end

    def to_s
      name
    end
  end
end

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
gaku_core-0.3.0 app/models/gaku/grading_method.rb
gaku_core-0.3.0.pre.4 app/models/gaku/grading_method.rb
gaku_core-0.3.0.pre.3 app/models/gaku/grading_method.rb
gaku_core-0.3.0.pre.2 app/models/gaku/grading_method.rb
gaku_core-0.3.0.pre.1 app/models/gaku/grading_method.rb
gaku_core-0.3.0.pre.0 app/models/gaku/grading_method.rb
gaku-0.2.4 core/app/models/gaku/grading_method.rb
gaku_core-0.2.4 app/models/gaku/grading_method.rb
gaku-0.2.3 core/app/models/gaku/grading_method.rb
gaku_core-0.2.3 app/models/gaku/grading_method.rb
gaku-0.2.2 core/app/models/gaku/grading_method.rb
gaku_core-0.2.2 app/models/gaku/grading_method.rb
gaku-0.2.1 core/app/models/gaku/grading_method.rb
gaku_core-0.2.1 app/models/gaku/grading_method.rb
gaku-0.2.0 core/app/models/gaku/grading_method.rb
gaku_core-0.2.0 app/models/gaku/grading_method.rb