diff --git a/CHANGELOG.md b/CHANGELOG.md index ff558ad9..de2292fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -41,3 +41,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Added +- Add Analyze page diff --git a/app/controllers/analyze_controller.rb b/app/controllers/analyze_controller.rb new file mode 100644 index 00000000..49292472 --- /dev/null +++ b/app/controllers/analyze_controller.rb @@ -0,0 +1,9 @@ +class AnalyzeController < SqmApplicationController + def index + @category ||= Category.find_by_category_id(params[:category_id]) + @category ||= Category.find_by_category_id(1) + + @subcategory ||= Subcategory.find_by_subcategory_id(params[:subcategory_id]) + @subcategory ||= Subcategory.find_by_subcategory_id('1A') + end +end diff --git a/app/controllers/overview_controller.rb b/app/controllers/overview_controller.rb index 5e7ed6e7..346fefbe 100644 --- a/app/controllers/overview_controller.rb +++ b/app/controllers/overview_controller.rb @@ -1,4 +1,6 @@ class OverviewController < SqmApplicationController + before_action :check_empty_dataset, only: [:index] + def index @variance_chart_row_presenters = Measure.all.map(&method(:presenter_for_measure)) @category_presenters = Category.sorted.map { |category| CategoryPresenter.new(category:) } @@ -11,4 +13,10 @@ class OverviewController < SqmApplicationController VarianceChartRowPresenter.new(measure:, score:) end + + def check_empty_dataset + @has_empty_dataset = Measure.all.all? do |measure| + measure.none_meet_threshold? school: @school, academic_year: @academic_year + end + end end diff --git a/app/controllers/sqm_application_controller.rb b/app/controllers/sqm_application_controller.rb index 57a17d41..3422e325 100644 --- a/app/controllers/sqm_application_controller.rb +++ b/app/controllers/sqm_application_controller.rb @@ -4,10 +4,6 @@ class SqmApplicationController < ApplicationController private - def authenticate_district - authenticate(@district.name.downcase, "#{@district.name.downcase}!") - end - def set_schools_and_districts @district = District.find_by_slug district_slug @districts = District.all.order(:name) @@ -15,9 +11,6 @@ class SqmApplicationController < ApplicationController @schools = School.includes([:district]).where(district: @district).order(:name) @academic_year = AcademicYear.find_by_range params[:year] @academic_years = AcademicYear.all.order(range: :desc) - @has_empty_dataset = Measure.all.all? do |measure| - measure.none_meet_threshold? school: @school, academic_year: @academic_year - end end def district_slug diff --git a/app/helpers/header_helper.rb b/app/helpers/header_helper.rb index e29fe908..8872eb5f 100644 --- a/app/helpers/header_helper.rb +++ b/app/helpers/header_helper.rb @@ -7,6 +7,10 @@ module HeaderHelper "/districts/#{district.slug}/schools/#{school.slug}/browse/teachers-and-leadership?year=#{academic_year.range}" end + def link_to_analyze(district:, school:, academic_year:) + "/districts/#{district.slug}/schools/#{school.slug}/analyze?year=#{academic_year.range}" + end + def district_url_for(district:, academic_year:) overview_link(district_slug: district.slug, school_slug: district.schools.alphabetic.first.slug, academic_year_range: academic_year.range, uri_path: request.fullpath) diff --git a/app/views/analyze/index.html.erb b/app/views/analyze/index.html.erb new file mode 100644 index 00000000..c80be234 --- /dev/null +++ b/app/views/analyze/index.html.erb @@ -0,0 +1,9 @@ +<% content_for :title do %> +