mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-07 21:48:16 -08:00
Refactor code based on rubocop and reek suggestions
This commit is contained in:
parent
1737122c80
commit
bb5f668497
51 changed files with 296 additions and 146 deletions
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AnalyzeController < SqmApplicationController
|
||||
def index
|
||||
assign_categories
|
||||
|
|
@ -19,7 +21,7 @@ class AnalyzeController < SqmApplicationController
|
|||
end
|
||||
|
||||
def assign_measures
|
||||
@measures = @subcategory.measures.order(:measure_id).includes(%i[scales admin_data_items subcategory])
|
||||
@measures = @subcategory.measures.order(:measure_id).includes(%i[subcategory])
|
||||
end
|
||||
|
||||
def assign_academic_years
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class ApplicationController < ActionController::Base
|
||||
before_action :set_google_analytics_id
|
||||
before_action :set_hotjar_id
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class CategoriesController < SqmApplicationController
|
||||
helper GaugeHelper
|
||||
def show
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class HomeController < ApplicationController
|
||||
helper HeaderHelper
|
||||
def index
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class OverviewController < SqmApplicationController
|
||||
before_action :check_empty_dataset, only: [:index]
|
||||
helper VarianceHelper
|
||||
|
|
@ -16,7 +18,7 @@ class OverviewController < SqmApplicationController
|
|||
end
|
||||
|
||||
def check_empty_dataset
|
||||
@has_empty_dataset = !subcategories.any? do |subcategory|
|
||||
@has_empty_dataset = subcategories.none? do |subcategory|
|
||||
response_rate = subcategory.response_rate(school: @school, academic_year: @academic_year)
|
||||
response_rate.meets_student_threshold || response_rate.meets_teacher_threshold
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class SqmApplicationController < ApplicationController
|
||||
protect_from_forgery with: :exception, prepend: true
|
||||
before_action :set_schools_and_districts
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue