mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-07 21:48:16 -08:00
Extract method_ids as private method in dashboard controller
This commit is contained in:
parent
b97227d116
commit
8780893d21
1 changed files with 14 additions and 6 deletions
|
|
@ -1,16 +1,24 @@
|
|||
class DashboardController < ApplicationController
|
||||
def index
|
||||
authenticate(district.name.downcase, "#{district.name.downcase}!")
|
||||
@measure_graph_row_presenters = Measure.where(measure_id: '1A-i').map do | measure |
|
||||
MeasureGraphRowPresenter.new(
|
||||
measure: measure,
|
||||
score: SurveyResponseAggregator.score(school: school, academic_year: academic_year, measure: measure)
|
||||
)
|
||||
end
|
||||
@measure_graph_row_presenters = measure_ids
|
||||
.map { |measure_id| Measure.find_by_measure_id measure_id }
|
||||
.map(&method(:presenter_for_measure))
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def measure_ids
|
||||
%w(1A-i)
|
||||
end
|
||||
|
||||
def presenter_for_measure(measure)
|
||||
MeasureGraphRowPresenter.new(
|
||||
measure: measure,
|
||||
score: SurveyResponseAggregator.score(school: school, academic_year: academic_year, measure: measure)
|
||||
)
|
||||
end
|
||||
|
||||
def school
|
||||
@school ||= School.find_by_slug school_slug
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue