class EcCourseSupport < ApplicationRecord
  default_scope { order(position: :asc) }

  belongs_to :ec_course
  belongs_to :ec_graduation_subitem
  # TODO: 将 ec_graduation_subitem_courses 移除，这个表作为关系表

  has_one :ec_graduation_requirement_calculation, dependent: :destroy

  validates :weights, presence: true, numericality: { greater_than_or_equal_to: 0, less_than_or_equal_to: 1 }

  number_display_methods :weights
end