Refactor code based on rubocop and reek suggestions

This commit is contained in:
rebuilt 2022-07-11 16:46:30 -07:00
parent 1737122c80
commit bb5f668497
51 changed files with 296 additions and 146 deletions

View file

@ -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

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class ApplicationController < ActionController::Base
before_action :set_google_analytics_id
before_action :set_hotjar_id

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class CategoriesController < SqmApplicationController
helper GaugeHelper
def show

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class HomeController < ApplicationController
helper HeaderHelper
def index

View file

@ -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

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class SqmApplicationController < ApplicationController
protect_from_forgery with: :exception, prepend: true
before_action :set_schools_and_districts