diff options
author | 2010-08-23 17:11:49 +0200 | |
---|---|---|
committer | 2010-10-05 22:15:29 +0300 | |
commit | 3556deb1eacc5ef81633d9068c043fc680ff5fed (patch) | |
tree | b50d2a384f0365759794f6d1523b721bfd065215 /app/models/answer.rb | |
parent | gRaphael files (diff) | |
download | recruiting-webapp-3556deb1eacc5ef81633d9068c043fc680ff5fed.tar.gz recruiting-webapp-3556deb1eacc5ef81633d9068c043fc680ff5fed.tar.bz2 recruiting-webapp-3556deb1eacc5ef81633d9068c043fc680ff5fed.zip |
Pie chart on how recruits evaluated documentation on questions how pages
Charts are shown only to recruiters on questions show pages, but other
users may view charts directly (by entering URL manually).
Diffstat (limited to 'app/models/answer.rb')
-rw-r--r-- | app/models/answer.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/app/models/answer.rb b/app/models/answer.rb index f013547..47544b3 100644 --- a/app/models/answer.rb +++ b/app/models/answer.rb @@ -47,6 +47,11 @@ class Answer < ActiveRecord::Base named_scope :in_category, lambda { |category| { :joins => :question, :conditions => { 'questions.question_category_id', category} } } + named_scope :with_feedback, lambda { |opt| { + :conditions => { :feedback => opt } } } + + named_scope :with_some_feedback, :conditions => "answers.feedback IS NOT NULL AND answers.feedback <> ''" + validates_uniqueness_of :question_id, :scope => :reference, :if => :reference validates_uniqueness_of :question_id, :scope => :owner_id, :unless => :reference |