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 %> +
Analysis of <%= @school.name %>
+<% end %> + +
+ +
diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb index 3e680bd6..a9615940 100644 --- a/app/views/layouts/_header.html.erb +++ b/app/views/layouts/_header.html.erb @@ -4,7 +4,8 @@
<%= link_to image_tag('sqm_logo.png', alt: 'MCIEA School Quality Measures Dashboard', class: 'height-56'), welcome_path, class: 'me-7' %> Overview - Browse + Browse + Analyze
@@ -32,6 +33,10 @@ <% if content_for?(:navigation) %> <%= yield(:navigation) %> <% end %> + + <% if content_for?(:title) %> + <%= yield(:title) %> + <% end %>
diff --git a/config/routes.rb b/config/routes.rb index f7651fb7..89938038 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -26,6 +26,7 @@ Rails.application.routes.draw do resources :schools, only: %i[index show] do resources :overview, only: [:index] resources :categories, only: [:show], path: 'browse' + resources :analyze, only: [:index] end end diff --git a/spec/system/journey_spec.rb b/spec/system/journey_spec.rb index 39bca07f..c5fd79a3 100644 --- a/spec/system/journey_spec.rb +++ b/spec/system/journey_spec.rb @@ -106,6 +106,9 @@ describe 'District Admin', js: true do go_to_different_district(different_district) district_admin_sees_district_change + got_to_analyze_page + district_admin_sees_analyze_content + # TODO: figure out why this test doesn't work # go_to_different_year(ay_2019_20) # district_admin_sees_year_change @@ -148,6 +151,10 @@ def go_to_different_year(year) select year.formatted_range, from: 'select-academic-year' end +def got_to_analyze_page + click_on 'Analyze' +end + def district_admin_sees_schools_change expected_path = "/districts/#{school_in_same_district.district.slug}/schools/#{school_in_same_district.slug}/browse/teachers-and-leadership?year=2020-21" expect(page).to have_current_path(expected_path) @@ -180,3 +187,7 @@ def district_admin_sees_browse_content expect(page).to have_text('Teachers & Leadership') expect(page).to have_text('Approval') end + +def district_admin_sees_analyze_content + expect(page).to have_text('1:Teachers & Leadership > 1A:Teachers & The Teaching Environment') +end