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.
33 lines
951 B
33 lines
951 B
#encoding: utf-8
|
|
class ExerciseQuestion < ActiveRecord::Base
|
|
include Redmine::SafeAttributes
|
|
default_scope :order => 'question_number'
|
|
|
|
belongs_to :exercise
|
|
belongs_to :shixun
|
|
has_many :exercise_shixun_challenges, :order => "#{ExerciseShixunChallenge.table_name}.position",:dependent => :destroy
|
|
has_many :exercise_shixun_answers, :dependent => :destroy
|
|
has_many :exercise_choices, :dependent => :destroy
|
|
has_many :exercise_answers, :dependent => :destroy
|
|
has_many :exercise_answer_comments, :dependent => :destroy
|
|
has_many :exercise_standard_answers, :dependent => :destroy
|
|
|
|
belongs_to :exercise_level_setting, counter_cache: true
|
|
has_many :exercise_user_questions, :dependent => :destroy
|
|
|
|
def question_type_name
|
|
case self.question_type
|
|
when 1
|
|
"单选题"
|
|
when 2
|
|
"多选题"
|
|
when 3
|
|
"填空题"
|
|
when 4
|
|
"简答题"
|
|
when 5
|
|
"实训题"
|
|
end
|
|
end
|
|
end
|