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.
|
|
|
|
class ExerciseAnswer < ApplicationRecord
|
|
|
|
|
#学生答题
|
|
|
|
|
belongs_to :user
|
|
|
|
|
belongs_to :exercise_question
|
|
|
|
|
belongs_to :exercise_choice, optional: true
|
|
|
|
|
has_many :exercise_answer_comments, :dependent => :destroy
|
|
|
|
|
|
|
|
|
|
scope :search_exercise_answer, lambda { |name,key| where("#{name} = ?",key)}
|
|
|
|
|
scope :search_answer_users, lambda {|name,ids| where("#{name}":ids)}
|
|
|
|
|
scope :exercise_no_full_scores, lambda { |score| where("score > 0.0 AND score < ?",score)}
|
|
|
|
|
scope :exercise_answer_is_right, -> {where("score > ?",0.0)} #判断答案是否正确,根据分数总和大于0
|
|
|
|
|
scope :score_reviewed, lambda {where("score >= ?",0.0)} #是否评分,用于判断主观题的
|
|
|
|
|
|
|
|
|
|
end
|