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.
educoder/app/models/exercise_shixun_answer.rb

14 lines
643 B

6 years ago
class ExerciseShixunAnswer < ApplicationRecord
belongs_to :exercise_question
belongs_to :user
belongs_to :exercise_shixun_challenge
6 years ago
has_many :exercise_answer_comments, :dependent => :delete_all
6 years ago
# status 0: 未通过, 1通过
# attr_accessible :answer_text, :score, :status
scope :search_shixun_answers, lambda {|name,ids| where("#{name}":ids)}
scope :search_shixun_keys, lambda { |name,key| where("#{name} = ?",key)}
scope :shixun_no_full_scores, lambda { |score| where("score > 0.0 AND score < ?",score)}
scope :score_reviewed, lambda {where("score is not NULL AND score >= ?",0.0)} #是否评分
end