Commit bb0ce50a0679927d335bfa11a6d882d24f30a14d
Exists in
master
and in
1 other branch
Merge branch 'stagingcharts' into staging
Conflicts: config/routes.rb
Showing
2 changed files
with
15 additions
and
1 deletions
Show diff stats
app/controllers/questions_controller.rb
| @@ -113,6 +113,20 @@ class QuestionsController < InheritedResources::Base | @@ -113,6 +113,20 @@ class QuestionsController < InheritedResources::Base | ||
| 113 | end | 113 | end |
| 114 | end | 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 | protected | 130 | protected |
| 117 | def export_votes | 131 | def export_votes |
| 118 | @question = Question.find(params[:id]) | 132 | @question = Question.find(params[:id]) |
config/routes.rb
| 1 | ActionController::Routing::Routes.draw do |map| | 1 | ActionController::Routing::Routes.draw do |map| |
| 2 | #map.resources :clicks | 2 | #map.resources :clicks |
| 3 | map.resources :visitors, :collection => {:votes_by_session_ids => :get} | 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 | question.resources :items | 5 | question.resources :items |
| 6 | question.resources :prompts, :member => {:vote_left => :post, :vote_right => :post, :skip => :post, :vote => :post}, | 6 | question.resources :prompts, :member => {:vote_left => :post, :vote_right => :post, :skip => :post, :vote => :post}, |
| 7 | :collection => {:single => :get, :index => :get} | 7 | :collection => {:single => :get, :index => :get} |