You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
407 B
18 lines
407 B
5 years ago
|
class ExaminationBank < ApplicationRecord
|
||
|
belongs_to :user
|
||
|
belongs_to :sub_discipline
|
||
|
|
||
|
has_many :tag_discipline_containers, as: :container, dependent: :destroy
|
||
|
has_many :tag_disciplines, through: :tag_discipline_containers
|
||
|
|
||
|
has_many :examination_items, dependent: :destroy
|
||
|
|
||
|
def question_count
|
||
|
examination_items.size
|
||
|
end
|
||
|
|
||
|
def total_score
|
||
|
examination_items.pluck(:score).sum
|
||
|
end
|
||
|
end
|