educoder/app/models/exercise_shixun_answer.rb

14 lines
640 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

class ExerciseShixunAnswer < ApplicationRecord
belongs_to :exercise_question
belongs_to :user
belongs_to :exercise_shixun_challenge
has_many :exercise_answer_comments, :dependent => :destroy
# 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