mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-08 23:18:18 -07:00
Add all pillars
This commit is contained in:
parent
8128af200b
commit
b6b88da328
4 changed files with 24 additions and 13 deletions
|
|
@ -2,7 +2,7 @@ class GpsController < ActionController::Base
|
|||
def index
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.csv { send_data Report::Gps.to_csv }
|
||||
format.csv { send_data Report::Gps.to_csv, disposition: 'attachment', filename: "gps_#{Date.today}.csv" }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
module Report
|
||||
class Gps
|
||||
def self.to_csv
|
||||
headers = ['School', 'Pillar', 'Indicator', 'Period', 'HALS Category', 'Measures', 'Score', 'Zone']
|
||||
headers = ['School', 'Pillar', 'Indicator', 'Period', 'HALS Category', 'Ref.', 'Score', 'Zone']
|
||||
attributes = %w[school_name pillar indicator period category measure_ids score zone]
|
||||
pillars = generate_pillars
|
||||
CSV.generate(headers: true) do |csv|
|
||||
|
|
@ -16,17 +16,29 @@ module Report
|
|||
schools = School.all
|
||||
academic_years = AcademicYear.order(range: :desc).first(2)
|
||||
periods = %w[Current Previous]
|
||||
indicator_1 = 'Teaching'
|
||||
measures_1 = [Measure.find_by_measure_id('1A-iii'), Measure.find_by_measure_id('1B-ii')]
|
||||
|
||||
[].tap do |pillars|
|
||||
schools.each do |school|
|
||||
academic_years.zip(periods).each do |academic_year, period|
|
||||
pillars << Pillar.new(school:, measures: measures_1, indicator: indicator_1, period:,
|
||||
academic_year:)
|
||||
academic_years.zip(periods).each do |academic_year, period|
|
||||
schools.each do |school|
|
||||
INDICATORS.each do |indicator, measures|
|
||||
pillars << Pillar.new(school:, measures:, indicator:, period:, academic_year:)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
INDICATORS =
|
||||
{ "Teaching Environment": [Measure.find_by_measure_id('1A-iii'), Measure.find_by_measure_id('1B-ii')],
|
||||
"Safety": Subcategory.find_by_subcategory_id('2A').measures,
|
||||
"Relationships": Subcategory.find_by_subcategory_id('2B').measures,
|
||||
"Academic Orientation": Subcategory.find_by_subcategory_id('2C').measures,
|
||||
"Facilities & Personnel": Subcategory.find_by_subcategory_id('3A').measures,
|
||||
"Family-School Relationships": [Measure.find_by_measure_id('3C-i')],
|
||||
"Community Involvement & External Partners": [Measure.find_by_measure_id('3C-ii')],
|
||||
"Perception of Performance": Subcategory.find_by_subcategory_id('4A').measures,
|
||||
"Student Commitment To Learning": Subcategory.find_by_subcategory_id('4B').measures,
|
||||
"Critical Thinking": Subcategory.find_by_subcategory_id('4C').measures,
|
||||
"College & Career Readiness": Subcategory.find_by_subcategory_id('4D').measures }
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ module Report
|
|||
end
|
||||
|
||||
def pillar
|
||||
pillars[indicator.to_sym]
|
||||
PILLARS[indicator.to_sym]
|
||||
end
|
||||
|
||||
def score
|
||||
|
|
@ -38,12 +38,12 @@ module Report
|
|||
approval_low_benchmark:,
|
||||
ideal_low_benchmark:)
|
||||
|
||||
zones.zone_for_score(score).type.to_s
|
||||
zones.zone_for_score(score).type.to_s.capitalize
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def pillars
|
||||
PILLARS =
|
||||
{ "Teaching Environment": 'Operational Efficiency',
|
||||
"Safety": 'Safe and Welcoming Environment',
|
||||
"Relationships": 'Safe and Welcoming Environment',
|
||||
|
|
@ -55,7 +55,6 @@ module Report
|
|||
"Student Commitment To Learning": 'Academics and Student Achievement',
|
||||
"Critical Thinking": 'Academics and Student Achievement',
|
||||
"College & Career Readiness": 'Academics and Student Achievement' }
|
||||
end
|
||||
|
||||
def watch_low_benchmark
|
||||
measures.map do |measure|
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ RSpec.describe Report::Pillar, type: :model do
|
|||
pillar = Report::Pillar.new(school:, measures:, indicator: 'The Teaching Environment', period: 'Current',
|
||||
academic_year: academic_year_1)
|
||||
expect(pillar.score).to eq 4.5
|
||||
expect(pillar.zone).to eq 'approval'
|
||||
expect(pillar.zone).to eq 'Approval'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue