Class: CompletionKit::ResponsesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/completion_kit/responses_controller.rb

Instance Method Summary collapse

Instance Method Details

#showObject



6
7
8
9
10
11
12
13
14
# File 'app/controllers/completion_kit/responses_controller.rb', line 6

def show
  @sort = params[:sort]
  ordered_ids = ordered_response_ids
  current_index = ordered_ids.index(@response.id)
  @response_number = current_index + 1
  @reviews = @response.reviews.includes(:metric)
  @prev_response = current_index > 0 ? ordered_ids[current_index - 1] : nil
  @next_response = ordered_ids[current_index + 1]
end