mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-07 13:38:18 -08:00
Create analyze page. Finishes #182097292
This commit is contained in:
parent
17ae2e582b
commit
cb5fe56c30
9 changed files with 49 additions and 8 deletions
|
|
@ -41,3 +41,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
## [Unreleased]
|
||||
|
||||
### Added
|
||||
- Add Analyze page
|
||||
|
|
|
|||
9
app/controllers/analyze_controller.rb
Normal file
9
app/controllers/analyze_controller.rb
Normal file
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
9
app/views/analyze/index.html.erb
Normal file
9
app/views/analyze/index.html.erb
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<% content_for :title do %>
|
||||
<div class="sub-header-2 color-white m-0"> Analysis of <%= @school.name %> </div>
|
||||
<% end %>
|
||||
|
||||
<div class="graph-content">
|
||||
<div class="breadcrumbs">
|
||||
<%= @category.category_id %>:<%= @category.name %> > <%= @subcategory.subcategory_id %>:<%= @subcategory.name %>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -4,7 +4,8 @@
|
|||
<div class="col d-flex justify-content-start align-items-center">
|
||||
<%= link_to image_tag('sqm_logo.png', alt: 'MCIEA School Quality Measures Dashboard', class: 'height-56'), welcome_path, class: 'me-7' %>
|
||||
<a class="sub-header-3 link me-4 <%= link_weight(path: 'overview') %>" href="<%= link_to_overview(district: @district, school: @school, academic_year: @academic_year) %>">Overview</a>
|
||||
<a class="sub-header-3 link <%= link_weight(path: 'browse') %>" href="<%= link_to_browse(district: @district, school: @school, academic_year: @academic_year) %>">Browse</a>
|
||||
<a class="sub-header-3 link me-4 <%= link_weight(path: 'browse') %>" href="<%= link_to_browse(district: @district, school: @school, academic_year: @academic_year) %>">Browse</a>
|
||||
<a class="sub-header-3 link <%= link_weight(path: 'analyze') %>" href="<%= link_to_analyze(district: @district, school: @school, academic_year: @academic_year) %>">Analyze</a>
|
||||
</div>
|
||||
|
||||
<div class="col d-flex justify-content-end">
|
||||
|
|
@ -32,6 +33,10 @@
|
|||
<% if content_for?(:navigation) %>
|
||||
<%= yield(:navigation) %>
|
||||
<% end %>
|
||||
|
||||
<% if content_for?(:title) %>
|
||||
<%= yield(:title) %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue