Commit 92dd57ad5100818469052866d1cca29e6e101adf
1 parent
e6ca0a59
Exists in
master
and in
1 other branch
add support for voter_map with just photocracy or aoi votes
Showing
3 changed files
with
28 additions
and
0 deletions
Show diff stats
app/controllers/questions_controller.rb
... | ... | @@ -167,6 +167,28 @@ class QuestionsController < InheritedResources::Base |
167 | 167 | visitor_id_hash[visitor.thevi] = visitor.the_votes_count |
168 | 168 | visitor_id_hash[visitor.thevi] = visitor.the_votes_count |
169 | 169 | end |
170 | + elsif scope == "all_photocracy_votes" | |
171 | + | |
172 | + votes_by_visitor_id= Vote.all(:select => 'visitors.identifier as thevi, count(*) as the_votes_count', | |
173 | + :joins => :voter, | |
174 | + :conditions => { :visitors => { :site_id => PHOTOCRACY_SITE_ID }}, | |
175 | + :group => "voter_id") | |
176 | + visitor_id_hash = {} | |
177 | + votes_by_visitor_id.each do |visitor| | |
178 | + visitor_id_hash[visitor.thevi] = visitor.the_votes_count | |
179 | + visitor_id_hash[visitor.thevi] = visitor.the_votes_count | |
180 | + end | |
181 | + elsif scope == "all_aoi_votes" | |
182 | + | |
183 | + votes_by_visitor_id= Vote.all(:select => 'visitors.identifier as thevi, count(*) as the_votes_count', | |
184 | + :joins => :voter, | |
185 | + :conditions => { :visitors => { :site_id => ALLOURIDEAS_SITE_ID }}, | |
186 | + :group => "voter_id") | |
187 | + visitor_id_hash = {} | |
188 | + votes_by_visitor_id.each do |visitor| | |
189 | + visitor_id_hash[visitor.thevi] = visitor.the_votes_count | |
190 | + visitor_id_hash[visitor.thevi] = visitor.the_votes_count | |
191 | + end | |
170 | 192 | elsif scope == "creators" |
171 | 193 | |
172 | 194 | questions_created_by_visitor_id = Question.all(:select => 'visitors.identifier as thevi, count(*) as questions_count', | ... | ... |
config/environments/development.rb
config/environments/production.rb