Class: SurveyResultsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/survey_results_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



2
3
4
5
6
7
8
9
10
11
12
13
# File 'app/controllers/survey_results_controller.rb', line 2

def index
  @story = Story.find(params[:story_id])
  @project = @story.project
  @results = {}
  @hide_sidebar = true
  
  @story.pages.each do |page|
    page.tasks.where(answer_type: { '$in' => ['Short text', 'Long text'] }).each do |task|
      @results[task.id.to_s] = task.results.paginate(page: params["result_#{task.id}_page".to_sym], per_page: 10)
    end
  end
end