Commit bb0ce50a0679927d335bfa11a6d882d24f30a14d

Authored by Dhruv Kapadia
2 parents 54592164 7b636606

Merge branch 'stagingcharts' into staging

Conflicts:
	config/routes.rb
app/controllers/questions_controller.rb
... ... @@ -113,6 +113,20 @@ class QuestionsController < InheritedResources::Base
113 113 end
114 114 end
115 115  
  116 + def object_info_totals_by_date
  117 + authenticate
  118 +
  119 + # eventually allow for users to specify type of export through params[:type]
  120 + @question = current_user.questions.find(params[:id])
  121 + hash = Vote.count(:conditions => "question_id = #{@question.id}", :group => "date(created_at)")
  122 +
  123 + respond_to do |format|
  124 + format.xml { render :xml => hash.to_xml and return}
  125 + end
  126 + end
  127 +
  128 +
  129 +
116 130 protected
117 131 def export_votes
118 132 @question = Question.find(params[:id])
... ...
config/routes.rb
1 1 ActionController::Routing::Routes.draw do |map|
2 2 #map.resources :clicks
3 3 map.resources :visitors, :collection => {:votes_by_session_ids => :get}
4   - map.resources :questions, :member => { :num_votes_by_visitor_id => :get, :export => :post, :set_autoactivate_ideas_from_abroad => :put, :activate => :put, :suspend => :put}, :collection => {:recent_votes_by_question_id => :get} do |question|
  4 + map.resources :questions, :member => { :object_info_totals_by_date => :get, :num_votes_by_visitor_id => :get, :export => :post, :set_autoactivate_ideas_from_abroad => :put, :activate => :put, :suspend => :put}, :collection => {:recent_votes_by_question_id => :get} do |question|
5 5 question.resources :items
6 6 question.resources :prompts, :member => {:vote_left => :post, :vote_right => :post, :skip => :post, :vote => :post},
7 7 :collection => {:single => :get, :index => :get}
... ...