Class: Testimonials::NpsResponsesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Testimonials::NpsResponsesController
- Defined in:
- app/controllers/testimonials/nps_responses_controller.rb
Overview
The NPS side of the dashboard: overall score plus the response list.
Constant Summary collapse
- PER_PAGE =
50
Instance Method Summary collapse
Instance Method Details
#index ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'app/controllers/testimonials/nps_responses_controller.rb', line 12 def index @score = NpsResponse.score @total = NpsResponse.count @promoters = NpsResponse.where(score: 9..10).count @passives = NpsResponse.where(score: 7..8).count @detractors = NpsResponse.where(score: 0..6).count @page = [params[:page].to_i, 1].max @responses = NpsResponse.newest_first.offset((@page - 1) * PER_PAGE).limit(PER_PAGE + 1).to_a @more = @responses.size > PER_PAGE @responses = @responses.first(PER_PAGE) end |