| Class | Response |
| In: |
app/models/response.rb
|
| Parent: | ActiveRecord::Base |
# File app/models/response.rb, line 17
17: def create_for_prompt(prompt, item_id_ext, voter_id_ext, options)
18: vote_id_ext = Pairwise.vote(prompt.prompt_id_ext, item_id_ext, voter_id_ext, options[:response_time])
19: create(options.merge(:vote_id_ext => vote_id_ext.first)) if vote_id_ext
20: end
# File app/models/response.rb, line 30
30: def refresh_response?(name, question_id)
31: (last = Param.find_by_name("#{name}_#{question_id}")).nil? || count(:conditions => "responses.id > #{last.value}", :joins => "INNER JOIN prompts ON (responses.prompt_id=prompts.id AND prompts.question_id=#{question_id})") > UntilRank::RESPONSES
32: end
# File app/models/response.rb, line 22
22: def update_last_response(name, question_id)
23: if last_res = Param.find_by_name("#{name}_#{question_id}")
24: last_res.update_attribute(:value, last.id)
25: else
26: Param.create(:name => "#{name}_#{question_id}", :value => last.id)
27: end if last
28: end