From 12415861c1516473ff4ee12ad1a9b6a3a746aa63 Mon Sep 17 00:00:00 2001 From: Alex Basson Date: Mon, 20 Sep 2021 14:21:19 -0400 Subject: [PATCH] Rename construct -> measure, seed with SqmCategories and Subcategories --- app/controllers/dashboard_controller.rb | 8 +- app/models/{construct.rb => measure.rb} | 4 +- ...ameters.rb => measure_graph_parameters.rb} | 2 +- app/models/sqm_category.rb | 3 + app/models/subcategory.rb | 3 + app/models/survey_item.rb | 2 +- ...ey_response.rb => survey_item_response.rb} | 2 +- app/models/survey_response_aggregator.rb | 6 +- ...nter.rb => measure_graph_row_presenter.rb} | 22 +-- ...t_bar_graph.erb => _measure_bar_graph.erb} | 30 ++-- app/views/dashboard/index.html.erb | 2 +- data/2021-measure-key.csv | 157 ++++++++++++++++++ ..._items.csv => AY2020-21_measure_items.csv} | 0 .../20210915151547_create_constructs.rb | 12 -- db/migrate/20210915151547_create_measures.rb | 12 ++ .../20210915183344_create_survey_items.rb | 5 +- ...0916143538_create_survey_item_responses.rb | 13 ++ .../20210916143538_create_survey_responses.rb | 13 -- .../20210920174840_create_sqm_categories.rb | 7 + .../20210920174941_create_subcategories.rb | 10 ++ ...eign_key_from_measures_to_subcategories.rb | 7 + db/schema.rb | 51 +++--- db/seeds.rb | 114 ++++--------- .../features/school_dashboard_feature_spec.rb | 16 +- spec/models/construct_spec.rb | 45 ----- spec/models/measure_spec.rb | 45 +++++ spec/models/survey_item_spec.rb | 2 +- .../models/survey_response_aggregator_spec.rb | 65 ++++---- ...rb => measure_graph_row_presenter_spec.rb} | 40 ++--- 29 files changed, 423 insertions(+), 275 deletions(-) rename app/models/{construct.rb => measure.rb} (94%) rename app/models/{construct_graph_parameters.rb => measure_graph_parameters.rb} (81%) create mode 100644 app/models/sqm_category.rb create mode 100644 app/models/subcategory.rb rename app/models/{survey_response.rb => survey_item_response.rb} (52%) rename app/presenters/{construct_graph_row_presenter.rb => measure_graph_row_presenter.rb} (74%) rename app/views/dashboard/{_construct_bar_graph.erb => _measure_bar_graph.erb} (54%) create mode 100644 data/2021-measure-key.csv rename data/{AY2020-21_construct_items.csv => AY2020-21_measure_items.csv} (100%) delete mode 100644 db/migrate/20210915151547_create_constructs.rb create mode 100644 db/migrate/20210915151547_create_measures.rb create mode 100644 db/migrate/20210916143538_create_survey_item_responses.rb delete mode 100644 db/migrate/20210916143538_create_survey_responses.rb create mode 100644 db/migrate/20210920174840_create_sqm_categories.rb create mode 100644 db/migrate/20210920174941_create_subcategories.rb create mode 100644 db/migrate/20210920175116_add_foreign_key_from_measures_to_subcategories.rb delete mode 100644 spec/models/construct_spec.rb create mode 100644 spec/models/measure_spec.rb rename spec/presenters/{construct_graph_row_presenter_spec.rb => measure_graph_row_presenter_spec.rb} (68%) diff --git a/app/controllers/dashboard_controller.rb b/app/controllers/dashboard_controller.rb index 81a54e27..d815ba1d 100644 --- a/app/controllers/dashboard_controller.rb +++ b/app/controllers/dashboard_controller.rb @@ -1,10 +1,10 @@ class DashboardController < ApplicationController def index authenticate(district.name.downcase, "#{district.name.downcase}!") - @construct_graph_row_presenters = Construct.where(construct_id: '1A-i').map do | construct | - ConstructGraphRowPresenter.new( - construct: construct, - score: SurveyResponseAggregator.score(school: school, academic_year: academic_year, construct: construct) + @measure_graph_row_presenters = Measure.where(measure_id: '1A-i').map do | measure | + MeasureGraphRowPresenter.new( + measure: measure, + score: SurveyResponseAggregator.score(school: school, academic_year: academic_year, measure: measure) ) end end diff --git a/app/models/construct.rb b/app/models/measure.rb similarity index 94% rename from app/models/construct.rb rename to app/models/measure.rb index 9ac78d7f..a7fc4c6b 100644 --- a/app/models/construct.rb +++ b/app/models/measure.rb @@ -1,4 +1,6 @@ -class Construct < ActiveRecord::Base +class Measure < ActiveRecord::Base + belongs_to :subcategory + Zone = Struct.new(:low_benchmark, :high_benchmark, :type) do def includes_score?(score) score > low_benchmark and score < high_benchmark diff --git a/app/models/construct_graph_parameters.rb b/app/models/measure_graph_parameters.rb similarity index 81% rename from app/models/construct_graph_parameters.rb rename to app/models/measure_graph_parameters.rb index 96dc2332..4766ae3a 100644 --- a/app/models/construct_graph_parameters.rb +++ b/app/models/measure_graph_parameters.rb @@ -1,4 +1,4 @@ -module ConstructGraphParameters +module MeasureGraphParameters module ZoneColor WARNING = "#FF73C0" WATCH = "#F096AD" diff --git a/app/models/sqm_category.rb b/app/models/sqm_category.rb new file mode 100644 index 00000000..3b2841c4 --- /dev/null +++ b/app/models/sqm_category.rb @@ -0,0 +1,3 @@ +class SqmCategory < ActiveRecord::Base + +end diff --git a/app/models/subcategory.rb b/app/models/subcategory.rb new file mode 100644 index 00000000..1e1afcc9 --- /dev/null +++ b/app/models/subcategory.rb @@ -0,0 +1,3 @@ +class Subcategory < ActiveRecord::Base + belongs_to :sqm_category +end diff --git a/app/models/survey_item.rb b/app/models/survey_item.rb index 66cad8a9..1a5f5c52 100644 --- a/app/models/survey_item.rb +++ b/app/models/survey_item.rb @@ -1,3 +1,3 @@ class SurveyItem < ActiveRecord::Base - belongs_to :construct + belongs_to :measure end diff --git a/app/models/survey_response.rb b/app/models/survey_item_response.rb similarity index 52% rename from app/models/survey_response.rb rename to app/models/survey_item_response.rb index 890b4656..cebd20f0 100644 --- a/app/models/survey_response.rb +++ b/app/models/survey_item_response.rb @@ -1,4 +1,4 @@ -class SurveyResponse < ActiveRecord::Base +class SurveyItemResponse < ActiveRecord::Base belongs_to :school belongs_to :survey_item end diff --git a/app/models/survey_response_aggregator.rb b/app/models/survey_response_aggregator.rb index 56eda0ff..bb4b9692 100644 --- a/app/models/survey_response_aggregator.rb +++ b/app/models/survey_response_aggregator.rb @@ -5,11 +5,11 @@ class Array end class SurveyResponseAggregator - def self.score(academic_year:, school:, construct:) - SurveyResponse + def self.score(academic_year:, school:, measure:) + SurveyItemResponse .where(academic_year: academic_year) .where(school: school) - .filter { |survey_response| survey_response.survey_item.construct == construct } + .filter { |survey_response| survey_response.survey_item.measure == measure } .map { |survey_response| survey_response.likert_score } .average end diff --git a/app/presenters/construct_graph_row_presenter.rb b/app/presenters/measure_graph_row_presenter.rb similarity index 74% rename from app/presenters/construct_graph_row_presenter.rb rename to app/presenters/measure_graph_row_presenter.rb index a16e06ed..f354e619 100644 --- a/app/presenters/construct_graph_row_presenter.rb +++ b/app/presenters/measure_graph_row_presenter.rb @@ -1,25 +1,25 @@ -class ConstructGraphRowPresenter - def initialize(construct:, score:) - @construct = construct +class MeasureGraphRowPresenter + def initialize(measure:, score:) + @measure = measure @score = score end - def construct_name - @construct.name + def measure_name + @measure.name end def bar_color case zone.type when :ideal - ConstructGraphParameters::ZoneColor::IDEAL + MeasureGraphParameters::ZoneColor::IDEAL when :approval - ConstructGraphParameters::ZoneColor::APPROVAL + MeasureGraphParameters::ZoneColor::APPROVAL when :growth - ConstructGraphParameters::ZoneColor::GROWTH + MeasureGraphParameters::ZoneColor::GROWTH when :watch - ConstructGraphParameters::ZoneColor::WATCH + MeasureGraphParameters::ZoneColor::WATCH else - ConstructGraphParameters::ZoneColor::WARNING + MeasureGraphParameters::ZoneColor::WARNING end end @@ -64,6 +64,6 @@ class ConstructGraphRowPresenter end def zone - @construct.zone_for_score(@score) + @measure.zone_for_score(@score) end end diff --git a/app/views/dashboard/_construct_bar_graph.erb b/app/views/dashboard/_measure_bar_graph.erb similarity index 54% rename from app/views/dashboard/_construct_bar_graph.erb rename to app/views/dashboard/_measure_bar_graph.erb index 720927aa..540366f7 100644 --- a/app/views/dashboard/_construct_bar_graph.erb +++ b/app/views/dashboard/_measure_bar_graph.erb @@ -1,9 +1,9 @@
<% heading_gutter = 30 %> - <% construct_row_height = 40 %> - <% graph_height = construct_graph_row_presenters.length * construct_row_height + heading_gutter %> - <% construct_row_bar_height = 20 %> + <% measure_row_height = 40 %> + <% graph_height = measure_graph_row_presenters.length * measure_row_height + heading_gutter %> + <% measure_row_bar_height = 20 %> <% label_padding_right = 24 %> xmlns="http://www.w3.org/2000/svg"> @@ -16,26 +16,26 @@ - fill-opacity="0.2" /> - fill-opacity="0.2" /> - fill-opacity="0.2" /> - fill-opacity="0.2" /> - fill-opacity="0.2" /> + fill-opacity="0.2" /> + fill-opacity="0.2" /> + fill-opacity="0.2" /> + fill-opacity="0.2" /> + fill-opacity="0.2" /> - - > - <%= construct_graph_row_presenters.each_with_index do |presenter, index| %> - y=<%= index * construct_row_height + construct_row_height / 2 %> text-anchor="end" dominant-baseline="middle"><%= presenter.construct_name %> + + > + <%= measure_graph_row_presenters.each_with_index do |presenter, index| %> + y=<%= index * measure_row_height + measure_row_height / 2 %> text-anchor="end" dominant-baseline="middle"><%= presenter.measure_name %> <% end %> - width="75%"> - <%= construct_graph_row_presenters.each_with_index do |presenter, index| %> - width="<%= presenter.bar_width %>" height=<%= construct_row_bar_height %> fill=<%= presenter.bar_color %> /> + width="75%"> + <%= measure_graph_row_presenters.each_with_index do |presenter, index| %> + width="<%= presenter.bar_width %>" height=<%= measure_row_bar_height %> fill=<%= presenter.bar_color %> /> <% end %> diff --git a/app/views/dashboard/index.html.erb b/app/views/dashboard/index.html.erb index c091c527..848c81c6 100644 --- a/app/views/dashboard/index.html.erb +++ b/app/views/dashboard/index.html.erb @@ -23,6 +23,6 @@

This graph shows how much a score is above or below the benchmark of any given scale.

- <%= render partial: "construct_bar_graph", locals: {construct_graph_row_presenters: @construct_graph_row_presenters}%> + <%= render partial: "measure_bar_graph", locals: { measure_graph_row_presenters: @measure_graph_row_presenters}%> diff --git a/data/2021-measure-key.csv b/data/2021-measure-key.csv new file mode 100644 index 00000000..de57d849 --- /dev/null +++ b/data/2021-measure-key.csv @@ -0,0 +1,157 @@ +Category,Subcategory,Measures,Measure Id,Source,Question/item,Revised Question (for the 19-20 surveys),Survey Item ID,Watch Low,Growth Low,Approval Low,Ideal Low +Teachers & Leadership,Teachers & The Teaching Environment,Professional Qualifications,1A-i,Admin Data,Percentage teachers with 5+ years of experience,,,2.49,3.00,3.50,4.71 +Teachers & Leadership,Teachers & The Teaching Environment,Professional Qualifications,1A-i,Admin Data,Percentage teachers teaching in area of licensure,,,2.49,3.00,3.50,4.71 +Teachers & Leadership,Teachers & The Teaching Environment,Professional Qualifications,1A-i,Teachers,How confident are you in working with the student body at your school?,,t-prep-q3,2.49,3.00,3.50,4.71 +Teachers & Leadership,Teachers & The Teaching Environment,Professional Qualifications,1A-i,Teachers,How prepared are you for teaching the topics that you are expected to teach in your assignment?,,t-prep-q2,2.49,3.00,3.50,4.71 +Teachers & Leadership,Teachers & The Teaching Environment,Professional Qualifications,1A-i,Teachers,Given your preparation for teaching how comfortable are you teaching at the grade-level you have been assigned?,,t-prep-q1,2.49,3.00,3.50,4.71 +Teachers & Leadership,Teachers & The Teaching Environment,Effective Practices,1A-ii,Students,"When you need extra help, how good is your teacher at giving you that help?",,s-peff-q3,2.49,3.00,3.50,4.71 +Teachers & Leadership,Teachers & The Teaching Environment,Effective Practices,1A-ii,Students,How well can your teacher tell whether or not you understand a topic?,,s-peff-q4,2.49,3.00,3.50,4.71 +Teachers & Leadership,Teachers & The Teaching Environment,Effective Practices,1A-ii,Students,How interesting does your teacher make the things you are learning?,,s-peff-q5,2.49,3.00,3.50,4.71 +Teachers & Leadership,Teachers & The Teaching Environment,Effective Practices,1A-ii,Students,How good is your teacher at helping you learn?,,s-peff-q6,2.49,3.00,3.50,4.71 +Teachers & Leadership,Teachers & The Teaching Environment,Effective Practices,1A-ii,Teachers,How confident are you in your ability to present material clearly?,,t-ieff-q1,2.49,3.00,3.50,4.71 +Teachers & Leadership,Teachers & The Teaching Environment,Effective Practices,1A-ii,Teachers,How confident are you in your ability to identify gaps in student understanding?,,t-ieff-q2,2.49,3.00,3.50,4.71 +Teachers & Leadership,Teachers & The Teaching Environment,Effective Practices,1A-ii,Teachers,How confident are you in your ability to provide extra help to students who need it?,,t-ieff-q3,2.49,3.00,3.50,4.71 +Teachers & Leadership,Teachers & The Teaching Environment,Effective Practices,1A-ii,Teachers,How confident are you in your ability to make material interesting for students?,,t-ieff-q4,2.49,3.00,3.50,4.71 +Teachers & Leadership,Teachers & The Teaching Environment,Effective Practices,1A-ii,Students,"Overall, how much have you learned from your teacher?",,s-peff-q1,2.49,3.00,3.50,4.71 +Teachers & Leadership,Teachers & The Teaching Environment,Effective Practices,1A-ii,Students,"For this class, how clearly does your teacher present the information that you need to learn?",,s-peff-q2,2.49,3.00,3.50,4.71 +Teachers & Leadership,Teachers & The Teaching Environment,Professional Community,1A-iii,Admin Data,Percent teacher returning (excluding retirement),,,2.69,3.20,3.70,4.71 +Teachers & Leadership,Teachers & The Teaching Environment,Professional Community,1A-iii,Teachers,How many teachers in this school feel responsible for helping each other do their best?,,t-pcom-q1,2.69,3.20,3.70,4.71 +Teachers & Leadership,Teachers & The Teaching Environment,Professional Community,1A-iii,Teachers,How many teachers in this school take responsibility for improving the school?,,t-pcom-q2,2.69,3.20,3.70,4.71 +Teachers & Leadership,Teachers & The Teaching Environment,Professional Community,1A-iii,Teachers,"This year, how often have you had conversations with your colleagues about what helps students learn?",,t-pcom-q3,2.69,3.20,3.70,4.71 +Teachers & Leadership,Teachers & The Teaching Environment,Professional Community,1A-iii,Teachers,"As a faculty, how well do you do talking through views, opinions, and values?",,t-pcom-q4,2.69,3.20,3.70,4.71 +Teachers & Leadership,Teachers & The Teaching Environment,Professional Community,1A-iii,Teachers,"This year, how often have you had colleagues observe your classroom?",,t-pcom-q5,2.69,3.20,3.70,4.71 +Teachers & Leadership,Leadership,Effective Leadership,1B-i,Teachers,"At your school, how comfortable are you raising concerns with the principal?",,t-prtr-q2,2.49,3.00,3.50,4.51 +Teachers & Leadership,Leadership,Effective Leadership,1B-i,Teachers,How much do you trust your principal to stand up for you in disagreements with parents?,,t-prtr-q3,2.49,3.00,3.50,4.51 +Teachers & Leadership,Leadership,Effective Leadership,1B-i,Teachers,How effectively does your principal communicate a clear vision of teaching and learning?,,t-inle-q1,2.49,3.00,3.50,4.51 +Teachers & Leadership,Leadership,Effective Leadership,1B-i,Teachers,How effectively does your principal press teachers to engage in good pedagogical practice?,,"t-inle-q2",2.49,3.00,3.50,4.51 +Teachers & Leadership,Leadership,Effective Leadership,1B-i,Teachers,How much does your principal know about what's going on in teachers' classrooms?,How much does your principal know about what’s going on in teachers’ classrooms either in-person or online?,t-inle-q3,2.49,3.00,3.50,4.51 +Teachers & Leadership,Leadership,Effective Leadership,1B-i,Teachers,To what extent do you trust your principal at his or her word?,,t-prtr-q1,2.49,3.00,3.50,4.51 +Teachers & Leadership,Leadership,Support For Teaching Development & Growth,1B-ii,Teachers,To what extent has your professional development included enough time to explore new ideas?,,t-qupd-q3,2.49,3.00,3.50,4.51 +Teachers & Leadership,Leadership,Support For Teaching Development & Growth,1B-ii,Teachers,How much would you say that your professional development has been sustained/consistent (rather than discontinuous)?,,t-qupd-q2,2.49,3.00,3.50,4.51 +Teachers & Leadership,Leadership,Support For Teaching Development & Growth,1B-ii,Teachers,How often do teachers here work together to plan curriculum and instruction?,,t-coll-q1,2.49,3.00,3.50,4.51 +Teachers & Leadership,Leadership,Support For Teaching Development & Growth,1B-ii,Teachers,How hard do teachers here work to coordinate their teaching with instruction at other grade levels?,,t-coll-q2,2.49,3.00,3.50,4.51 +Teachers & Leadership,Leadership,Support For Teaching Development & Growth,1B-ii,Teachers,How often do teachers here collaborate to make the school run effectively?,,t-coll-q3,2.49,3.00,3.50,4.51 +Teachers & Leadership,Leadership,Support For Teaching Development & Growth,1B-ii,Teachers,"Overall, how strong has support for your professional growth been?",,t-qupd-q4,2.49,3.00,3.50,4.51 +Teachers & Leadership,Leadership,Support For Teaching Development & Growth,1B-ii,Teachers,To what extent has your professional development been connected to the topics you teach?,,t-qupd-q1,2.49,3.00,3.50,4.51 +School Culture,Safety,Student Physical Safety Scale,2A-i,Students,How often do students get into physical fights at your school?,,s-phys-q2,2.79,3.30,3.80,4.51 +School Culture,Safety,Student Physical Safety Scale,2A-i,Students,"Overall, how physically safe do you feel at school?",,s-phys-q3,2.79,3.30,3.80,4.51 +School Culture,Safety,Student Physical Safety Scale,2A-i,Students,How often do you feel like you might be harmed by someone at school?,,s-phys-q4,2.79,3.30,3.80,4.51 +School Culture,Safety,Student Physical Safety Scale,2A-i,Students,How often do you worry about violence at your school?,,s-phys-q1,2.79,3.30,3.80,4.51 +School Culture,Safety,Student Emotional Safety,2A-ii,Teachers,How often are students bullied at school?,How often are students bullied at school or online?,t-pvic-q1,2.79,3.30,3.80,4.51 +School Culture,Safety,Student Emotional Safety,2A-ii,Teachers,How often are students bullied because of who they are?,,t-pvic-q2,2.79,3.30,3.80,4.51 +School Culture,Safety,Student Emotional Safety,2A-ii,Teachers,"Overall, how unkind are students to each other?",,t-pvic-q3,2.79,3.30,3.80,4.51 +School Culture,Safety,Student Emotional Safety,2A-ii,Students,How often are students at this school unkind to each other online?,,s-emsa-q2,2.79,3.30,3.80,4.51 +School Culture,Safety,Student Emotional Safety,2A-ii,Students,How much bullying occurs at this school?,,s-emsa-q3,2.79,3.30,3.80,4.51 +School Culture,Safety,Student Emotional Safety,2A-ii,Students,How often are students unkind to each other at this school?,,s-emsa-q1,2.79,3.30,3.80,4.51 +School Culture,Relationships,Student Sense of Belonging,2B-i,Teachers,How much do students at this school care about each other?,,t-psup-q1,2.24,2.75,3.25,4.51 +School Culture,Relationships,Student Sense of Belonging,2B-i,Teachers,How often do students at this school help each other learn?,,t-psup-q2,2.24,2.75,3.25,4.51 +School Culture,Relationships,Student Sense of Belonging,2B-i,Teachers,"At this school, how respectful are students to each other?",,t-psup-q4,2.24,2.75,3.25,4.51 +School Culture,Relationships,Student Sense of Belonging,2B-i,Students,"At your school, how accepted do you feel by the other students?",,s-sbel-q2,2.24,2.75,3.25,4.51 +School Culture,Relationships,Student Sense of Belonging,2B-i,Students,How well do people at your school understand you?,,s-sbel-q3,2.24,2.75,3.25,4.51 +School Culture,Relationships,Student Sense of Belonging,2B-i,Students,How much respect do students in your school show you?,,s-sbel-q4,2.24,2.75,3.25,4.51 +School Culture,Relationships,Student Sense of Belonging,2B-i,Students,How connected do you feel to the adults at your school?,,s-sbel-q5,2.24,2.75,3.25,4.51 +School Culture,Relationships,Student Sense of Belonging,2B-i,Students,"Overall, how much do you feel like you belong at your school?",,s-sbel-q1,2.24,2.75,3.25,4.51 +School Culture,Relationships,Student Sense of Belonging,2B-i,Teachers,How well do students at this school get along with each other?,,t-psup-q3,2.24,2.75,3.25,4.51 +School Culture,Relationships,Student-Teacher Relationships,2B-ii,Students,"When your teacher asks how you are doing, how often do you feel that he/she is really interested in your answer?",,s-tint-q1,2.24,2.75,3.25,4.51 +School Culture,Relationships,Student-Teacher Relationships,2B-ii,Students,How interested in your teacher in what you do outside of class?,,s-tint-q2,2.24,2.75,3.25,4.51 +School Culture,Relationships,Student-Teacher Relationships,2B-ii,Students,"If you walked into class upset, how concerned would your teacher be?",,s-tint-q3,2.24,2.75,3.25,4.51 +School Culture,Relationships,Student-Teacher Relationships,2B-ii,Students,"If you came back to visit class three years from now, how excited would your teacher be to see you?",,s-tint-q4,2.24,2.75,3.25,4.51 +School Culture,Relationships,Student-Teacher Relationships,2B-ii,Students,"If you had something on your mind, how carefully would your teacher listen to you?",,s-tint-q5,2.24,2.75,3.25,4.51 +School Culture,Academic Orientation,Valuing of Learning,2C-i,Students,"Overall, how important is school to you?",,s-vale-q1,2.69,3.20,3.70,4.51 +School Culture,Academic Orientation,Valuing of Learning,2C-i,Students,How curious are you to learn more about things you talked about in school?,,s-vale-q2,2.69,3.20,3.70,4.51 +School Culture,Academic Orientation,Valuing of Learning,2C-i,Students,How much do you enjoy learning in school?,,s-vale-q3,2.69,3.20,3.70,4.51 +School Culture,Academic Orientation,Valuing of Learning,2C-i,Students,How much do you see yourself as a learner?,,s-vale-q4,2.69,3.20,3.70,4.51 +School Culture,Academic Orientation,Valuing of Learning,2C-i,Admin Data,Chronic absence rate,,,2.69,3.20,3.70,4.51 +School Culture,Academic Orientation,Valuing of Learning,2C-i,Admin Data,Average daily attendance,,,2.69,3.20,3.70,4.51 +School Culture,Academic Orientation,Academic Challenge,2C-ii,Students,How often does your teacher ask you to explain your answers?,,s-acpr-q3,2.69,3.20,3.70,4.51 +School Culture,Academic Orientation,Academic Challenge,2C-ii,Students,How much does your teacher encourage you to do your best?,,s-acpr-q1,2.69,3.20,3.70,4.51 +School Culture,Academic Orientation,Academic Challenge,2C-ii,Students,"When you feel like giving up on a difficult task, how likely is it that your teacher will help you keep trying?",,s-acpr-q2,2.69,3.20,3.70,4.51 +School Culture,Academic Orientation,Academic Challenge,2C-ii,Teachers,How effectively does your school challenge students who are struggling academically,,t-acch-q2,2.69,3.20,3.70,4.51 +School Culture,Academic Orientation,Academic Challenge,2C-ii,Teachers,How effectively does your school challenge students who are thriving academically?,,t-acch-q3,2.69,3.20,3.70,4.51 +School Culture,Academic Orientation,Academic Challenge,2C-ii,Teachers,How well does your school foster academic challenge for all students?,,t-acch-q1,2.69,3.20,3.70,4.51 +School Culture,Academic Orientation,Academic Challenge,2C-ii,Students,How often does your teacher take time to make sure you understand the material?,,s-acpr-q4,2.69,3.20,3.70,4.51 +Resources,Facilities and Personnel,Physical Space & Materials,3A-i,Admin Data,Average class size,,,2.34,2.85,3.35,4.26 +Resources,Facilities and Personnel,Physical Space & Materials,3A-i,Teachers,How adequate is your access to the materials you need to effectively teach?,,t-reso-q1,2.34,2.85,3.35,4.26 +Resources,Facilities and Personnel,Physical Space & Materials,3A-i,Teachers,How adequate is your access to the technology you need to effectively teach?,,t-reso-q2,2.34,2.85,3.35,4.26 +Resources,Facilities and Personnel,Physical Space & Materials,3A-i,Teachers,How adequate is the support you receive for using technology?,,t-reso-q3,2.34,2.85,3.35,4.26 +Resources,Facilities and Personnel,Physical Space & Materials,3A-i,Teachers,How sufficient is the physical space for school activities?,How sufficient is the physical space for in-school activities during the pandemic?,t-reso-q4,2.34,2.85,3.35,4.26 +Resources,Facilities and Personnel,Physical Space & Materials,3A-i,Teachers,How well-maintained are school facilities?,How well-maintained are school facilities during the pandemic?,t-reso-q5,2.34,2.85,3.35,4.26 +Resources,Facilities and Personnel,Content Specialists & Support Staff,3A-ii,Admin Data,Student to guidance counselor ratio,,,2.34,2.85,3.35,4.26 +Resources,Facilities and Personnel,Content Specialists & Support Staff,3A-ii,Admin Data,Student to instructional support staff ratio,,,2.34,2.85,3.35,4.26 +Resources,Facilities and Personnel,Content Specialists & Support Staff,3A-ii,Teachers,"Overall, how effective is the support students receive from non-teaching staff?",,t-sust-q1,2.34,2.85,3.35,4.26 +Resources,Facilities and Personnel,Content Specialists & Support Staff,3A-ii,Teachers,How adequate is the number of non-teaching support staff?,,t-sust-q2,2.34,2.85,3.35,4.26 +Resources,Facilities and Personnel,Content Specialists & Support Staff,3A-ii,Teachers,How often are non-teaching support staff available for students with non-academic issues?,How often are non-teaching support staff available either online or in person for students with non-academic issues?,t-sust-q3,2.34,2.85,3.35,4.26 +Resources,Facilities and Personnel,Content Specialists & Support Staff,3A-ii,Teachers,How often are non-teaching support staff available for students who are struggling academically?,How often are non-teaching support staff available either online or in person for students who are struggling academically?,t-sust-q4,2.34,2.85,3.35,4.26 +Resources,Facilities and Personnel,Content Specialists & Support Staff,3A-ii,Students,"When you need help learning something, is there an adult at school other than your teacher who can work with you?",,s-sust-q2,2.34,2.85,3.35,4.26 +Resources,Facilities and Personnel,Content Specialists & Support Staff,3A-ii,Students,"When you are hurt, sad, or just need to talk to someone, is there an adult at school other than your teacher you can go to?",,s-sust-q1,2.34,2.85,3.35,4.26 +Resources,Learning Resources,Curricular Strength & Variety,3B-i,Admin Data,Percent graduates completing MassCORE (HS only),,,2.34,2.85,3.35,4.61 +Resources,Learning Resources,Curricular Strength & Variety,3B-i,Admin Data,Percent juniors and seniors enrolled in one AP (HS only),,,2.34,2.85,3.35,4.61 +Resources,Learning Resources,Curricular Strength & Variety,3B-i,Admin Data,Percent AP test takers scoring 3 or higher (HS only),,,2.34,2.85,3.35,4.61 +Resources,Learning Resources,Curricular Strength & Variety,3B-i,Teachers,"Overall, how rigorous is the curriculum that you are expected to teach?",,t-curv-q1,2.34,2.85,3.35,4.61 +Resources,Learning Resources,Curricular Strength & Variety,3B-i,Teachers,How coherent is the curriculum that you are expected to teach?,,t-curv-q2,2.34,2.85,3.35,4.61 +Resources,Learning Resources,Curricular Strength & Variety,3B-i,Teachers,"If one of your students transferred to another district with a challenging assortment of courses, how well prepared would he or she be?",,t-curv-q3,2.34,2.85,3.35,4.61 +Resources,Learning Resources,Curricular Strength & Variety,3B-i,Teachers,How well-rounded is the curriculum that you and your colleagues teach?,,t-curv-q4,2.34,2.85,3.35,4.61 +Resources,Learning Resources,Cultural Responsiveness,3B-ii,Teachers,How able are you to integrate material from different cultures into your class?,How able are you to integrate material from different cultures into your instruction either online or in person?',t-cure-q1,2.34,2.85,3.35,4.61 +Resources,Learning Resources,Cultural Responsiveness,3B-ii,Teachers,How often do you integrate culturally diverse content into your teaching?,,t-cure-q2,2.34,2.85,3.35,4.61 +Resources,Learning Resources,Cultural Responsiveness,3B-ii,Teachers,How often do you use teaching strategies to facilitate learning among culturally diverse students?,,t-cure-q3,2.34,2.85,3.35,4.61 +Resources,Learning Resources,Cultural Responsiveness,3B-ii,Teachers,How motivated are you to integrate culturally diverse content in your classroom?,,t-cure-q4,2.34,2.85,3.35,4.61 +Resources,Learning Resources,Cultural Responsiveness,3B-ii,Students,"In your classes, how often do you see many different kinds of people represented in what you study?",,s-cure-q2,2.34,2.85,3.35,4.61 +Resources,Learning Resources,Cultural Responsiveness,3B-ii,Students,How valued do you think all students' home cultures and languages are in the school curriculum?,,s-cure-q3,2.34,2.85,3.35,4.61 +Resources,Learning Resources,Cultural Responsiveness,3B-ii,Students,How valued do you think your home culture and language are in the school curriculum?,,s-cure-q4,2.34,2.85,3.35,4.61 +Resources,Learning Resources,Cultural Responsiveness,3B-ii,Students,"In your classes, how often do you see people like you represented in what you study?",,s-cure-q1,2.34,2.85,3.35,4.61 +Resources,Learning Resources,Co-Curricular Activities,3B-iii,Admin Data,Student to co-curricular activities ratio (HS only),,,2.34,2.85,3.35,4.61 +Resources,Community Support,Family-School Relationships,3C-i,Teachers,How often do you connect with parents at your school?,,t-peng-q1,2.19,2.70,3.20,4.41 +Resources,Community Support,Family-School Relationships,3C-i,Teachers,How involved have parents been in fundraising efforts at your school?,,t-peng-q2,2.19,2.70,3.20,4.41 +Resources,Community Support,Family-School Relationships,3C-i,Teachers,How involved have parents been with parent groups at your school?,,t-peng-q3,2.19,2.70,3.20,4.41 +Resources,Community Support,Family-School Relationships,3C-i,Teachers,How often does the average parent help out at your school?,,t-peng-q4,2.19,2.70,3.20,4.41 +Resources,Community Support,"Community Involvement, External Partners",3C-ii,Teachers,"How effectively does this school connect with immigrant parents, providing translation when necessary?","How effectively does this school connect with immigrant families, providing translation when necessary?",t-ceng-q1,2.19,2.70,3.20,4.41 +Resources,Community Support,"Community Involvement, External Partners",3C-ii,Teachers,How effectively does this school respond to the needs and values the surrounding community?,How effectively does this school respond to the needs and values of the surrounding community?,t-ceng-q2,2.19,2.70,3.20,4.41 +Resources,Community Support,"Community Involvement, External Partners",3C-ii,Teachers,To what extent are all groups of parents represented in the governance of the school?,,t-ceng-q3,2.19,2.70,3.20,4.41 +Resources,Community Support,"Community Involvement, External Partners",3C-ii,Teachers,"Overall, how effectively does this school connect with the community?",,t-ceng-q4,2.19,2.70,3.20,4.41 +Academic Learning,Performance,Performance Growth,4A-i,No source,Performance Growth,,,2.49,3.00,3.50,4.51 +Academic Learning,Performance,Overall Performance,4A-ii,Teachers,"If an observer sat in on one of your classes for a week, how would s/he rate your students?","If an observer sat in on one of your classes for a week (either online or in person), how would she or he rate your students?",t-sach-q3,2.49,3.00,3.50,4.51 +Academic Learning,Performance,Overall Performance,4A-ii,Teachers,"Relative to what you know of students this age, how academically able are your students?",,t-sach-q1,2.49,3.00,3.50,4.51 +Academic Learning,Performance,Overall Performance,4A-ii,Teachers,"If student work from your classes was compared with work from ""average"" Massachusetts classes of the same grades/subjects, how do you think an objective observer would rate the work?",,t-sach-q2,2.49,3.00,3.50,4.51 +Academic Learning,Student Commitment To Learning,Engagement In School,4B-i,Students,"Overall, how interested are you in this class?",,s-sten-q2,2.39,2.90,3.40,4.41 +Academic Learning,Student Commitment To Learning,Engagement In School,4B-i,Students,How often do you get so focused on class activities that you lose track of time?,,s-sten-q3,2.39,2.90,3.40,4.41 +Academic Learning,Student Commitment To Learning,Engagement In School,4B-i,Students,How excited are you about going to this class?,,s-sten-q1,2.39,2.90,3.40,4.41 +Academic Learning,Student Commitment To Learning,Degree completion,4B-ii,Admin Data,4-year on-time graduation rate (HS only),,,2.39,2.90,3.40,4.41 +Academic Learning,Student Commitment To Learning,Degree completion,4B-ii,Admin Data,5-year graduation rate (HS only),,,2.39,2.90,3.40,4.41 +Academic Learning,Critical Thinking,Problem Solving Emphasis,4C-i,Teachers,How often do students at your school come up with their own interpretations of material?,,t-psol-q1,2.39,2.90,3.40,4.41 +Academic Learning,Critical Thinking,Problem Solving Emphasis,4C-i,Teachers,How often do students apply ideas they have learned to new situations?,,t-psol-q2,2.39,2.90,3.40,4.41 +Academic Learning,Critical Thinking,Problem Solving Emphasis,4C-i,Teachers,How often do students collaborate in class to solve complex problems?,How often do students collaborate in class to solve complex problems either online or in person?,t-psol-q3,2.39,2.90,3.40,4.41 +Academic Learning,Critical Thinking,Problem Solving Skills,4C-ii,No source,Problem Solving Skills,,,2.39,2.90,3.40,4.41 +Academic Learning,College & Career Readiness,College-Going & Persistence,4D-i,Admin Data,College enrollment rate (HS only),,,2.39,2.90,3.40,4.41 +Academic Learning,College & Career Readiness,Career Preparation & Placement,4D-ii,Admin Data,Career Preparation and Placement,,,2.49,3.00,3.50,4.41 +Citizenship & Wellbeing,Civic Engagement,Appreciation For Diversity,5A-i,Students,How often do you try to think of more than one explanation for why someone else acted as they did?,,s-sper-q1,2.49,3.00,3.50,4.41 +Citizenship & Wellbeing,Civic Engagement,Appreciation For Diversity,5A-i,Students,"Overall, how often do you try to understand the point of view of other people?",,s-sper-q2,2.49,3.00,3.50,4.41 +Citizenship & Wellbeing,Civic Engagement,Appreciation For Diversity,5A-i,Students,How often do you try to figure out what motivates others to behave as they do?,,s-sper-q3,2.49,3.00,3.50,4.41 +Citizenship & Wellbeing,Civic Engagement,Appreciation For Diversity,5A-i,Students,"In general, how often do you try to understand how other people see things?",,s-sper-q4,2.49,3.00,3.50,4.41 +Citizenship & Wellbeing,Civic Engagement,Civic Participation,5A-ii,Students,"How much do you believe that being concerned with national, state, and local issues is everyone's responsibility?",,s-civp-q1,2.49,3.00,3.50,4.41 +Citizenship & Wellbeing,Civic Engagement,Civic Participation,5A-ii,Students,How important is it to you to get involved in improving your community?,,s-civp-q2,2.49,3.00,3.50,4.41 +Citizenship & Wellbeing,Civic Engagement,Civic Participation,5A-ii,Students,How important is it to you to actively challenge inequalities in society?,,s-civp-q3,2.49,3.00,3.50,4.41 +Citizenship & Wellbeing,Civic Engagement,Civic Participation,5A-ii,Students,How important is it to you to take action when something in society needs changing?,,s-civp-q4,2.49,3.00,3.50,4.41 +Citizenship & Wellbeing,Work Ethic,Perseverance & Determination,5B-i,Students,How important is it to you to finish things you start?,,s-grit-q2,2.24,2.75,3.25,4.31 +Citizenship & Wellbeing,Work Ethic,Perseverance & Determination,5B-i,Students,"How confident are you that you can remain focused on what you are doing, even when there are distractions?",,s-grit-q3,2.24,2.75,3.25,4.31 +Citizenship & Wellbeing,Work Ethic,Perseverance & Determination,5B-i,Students,"If you fail to reach an important goal, how likely are you to try again?",,s-grit-q4,2.24,2.75,3.25,4.31 +Citizenship & Wellbeing,Work Ethic,Perseverance & Determination,5B-i,Students,"If you face a problem while working towards an important goal, how well can you keep working?",,s-grit-q1,2.24,2.75,3.25,4.31 +Citizenship & Wellbeing,Work Ethic,Growth Mindset,5B-ii,Students,How much do you think you can change your own intelligence?,,s-grmi-q1,2.24,2.75,3.25,4.31 +Citizenship & Wellbeing,Work Ethic,Growth Mindset,5B-ii,Students,How much do you think that being bad at math is something someone can change?,,s-grmi-q2,2.24,2.75,3.25,4.31 +Citizenship & Wellbeing,Work Ethic,Growth Mindset,5B-ii,Students,How much do you think that struggling as a writer is something someone can change?,,s-grmi-q3,2.24,2.75,3.25,4.31 +Citizenship & Wellbeing,Work Ethic,Growth Mindset,5B-ii,Students,How much do you think that struggling to understand something means you're bad at it?,How much do you think that intelligence is something that can be changed?,s-grmi-q4,2.24,2.75,3.25,4.31 +Citizenship & Wellbeing,Creative & Performing Arts,Participation In Creative & Performing Arts,5C-i,Teachers,"In a typical week at your school, what is the average amount of time students spend in creative arts instruction or activities?","In a typical week at your school, what is the average amount of time a student could spend in creative arts instruction or activities?",t-expa-q2,2.24,2.75,3.25,4.31 +Citizenship & Wellbeing,Creative & Performing Arts,Participation In Creative & Performing Arts,5C-i,Students,"In a typical week, how much time do you spend in creative arts instruction or activities?",,s-expa-q1,2.24,2.75,3.25,4.31 +Citizenship & Wellbeing,Creative & Performing Arts,Participation In Creative & Performing Arts,5C-i,Teachers,"In a typical week at your school, what is the maximum amount of time a student could spend in creative arts instruction or activities?",,t-expa-q3,2.24,2.75,3.25,4.31 +Citizenship & Wellbeing,Creative & Performing Arts,Valuing Creative & Performing Arts,5C-ii,Students,"If your friends or family wanted to go to an art museum, how interested would you be in going?","How interested are you in visual art—street murals, museum paintings, sculptures, etc.?",s-appa-q1,2.24,2.75,3.25,4.31 +Citizenship & Wellbeing,Creative & Performing Arts,Valuing Creative & Performing Arts,5C-ii,Students,"If your friends or family wanted to go to hear people play music, how interested would you be in going?",,s-appa-q2,2.24,2.75,3.25,4.31 +Citizenship & Wellbeing,Creative & Performing Arts,Valuing Creative & Performing Arts,5C-ii,Students,"If your friends or family wanted to go to a play, how interested would you be in going?","How interested are you in performance art—dance performances, plays in the park, going to the theater, etc.?",s-appa-q3,2.24,2.75,3.25,4.31 +Citizenship & Wellbeing,Health,Social & Emotional Health,5D-i,Students,"On a regular day at school, how often do you feel relaxed?",,s-poaf-q1,2.24,2.75,3.25,4.31 +Citizenship & Wellbeing,Health,Social & Emotional Health,5D-i,Students,How often are you enthusiastic at school?,,s-poaf-q2,2.24,2.75,3.25,4.31 +Citizenship & Wellbeing,Health,Social & Emotional Health,5D-i,Students,"On a normal day in school, how confident do you feel?",,s-poaf-q3,2.24,2.75,3.25,4.31 +Citizenship & Wellbeing,Health,Social & Emotional Health,5D-i,Students,"On a normal day in school, how much are you able to concentrate?",,s-poaf-q4,2.24,2.75,3.25,4.31 +Citizenship & Wellbeing,Health,Social & Emotional Health,5D-i,Students,"On a typical day in school, how stressed do you feel about your schoolwork?",,s-acst-q1,2.24,2.75,3.25,4.31 +Citizenship & Wellbeing,Health,Social & Emotional Health,5D-i,Students,"When you take a test, how much do you worry about doing well?",,s-acst-q2,2.24,2.75,3.25,4.31 +Citizenship & Wellbeing,Health,Social & Emotional Health,5D-i,Students,How much do you think that your grades and test scores will determine your future?,"Typically, how anxious do you feel about your grades?",s-acst-q3,2.24,2.75,3.25,4.31 +Citizenship & Wellbeing,Health,Physical Health,5D-ii,Admin Data,Medical staff to student ratio,,,2.24,2.75,3.25,4.31 +Citizenship & Wellbeing,Health,Physical Health,5D-ii,Teachers,"In a typical week at your school, what is the average amount of time students spend engaged in physical activity?","In a typical week at your school, what is the average amount of time a student could spend engaged in physical activity?",t-phya-q2,2.24,2.75,3.25,4.31 +Citizenship & Wellbeing,Health,Physical Health,5D-ii,Teachers,"In a typical week at your school, what is the maximum amount of time a student could spend engaged in physical activity?",,t-phya-q3,2.24,2.75,3.25,4.31 \ No newline at end of file diff --git a/data/AY2020-21_construct_items.csv b/data/AY2020-21_measure_items.csv similarity index 100% rename from data/AY2020-21_construct_items.csv rename to data/AY2020-21_measure_items.csv diff --git a/db/migrate/20210915151547_create_constructs.rb b/db/migrate/20210915151547_create_constructs.rb deleted file mode 100644 index 7b99e42e..00000000 --- a/db/migrate/20210915151547_create_constructs.rb +++ /dev/null @@ -1,12 +0,0 @@ -class CreateConstructs < ActiveRecord::Migration[5.0] - def change - create_table :constructs do |t| - t.string :construct_id - t.string :name - t.float :watch_low_benchmark - t.float :growth_low_benchmark - t.float :approval_low_benchmark - t.float :ideal_low_benchmark - end - end -end diff --git a/db/migrate/20210915151547_create_measures.rb b/db/migrate/20210915151547_create_measures.rb new file mode 100644 index 00000000..cfed2b39 --- /dev/null +++ b/db/migrate/20210915151547_create_measures.rb @@ -0,0 +1,12 @@ +class CreateMeasures < ActiveRecord::Migration[5.0] + def change + create_table :measures do |t| + t.string :measure_id, null: false + t.string :name + t.float :watch_low_benchmark, null: false + t.float :growth_low_benchmark, null: false + t.float :approval_low_benchmark, null: false + t.float :ideal_low_benchmark, null: false + end + end +end diff --git a/db/migrate/20210915183344_create_survey_items.rb b/db/migrate/20210915183344_create_survey_items.rb index da3ba9e8..69538d49 100644 --- a/db/migrate/20210915183344_create_survey_items.rb +++ b/db/migrate/20210915183344_create_survey_items.rb @@ -1,10 +1,11 @@ class CreateSurveyItems < ActiveRecord::Migration[5.0] def change create_table :survey_items do |t| - t.integer :construct_id + t.integer :measure_id, null: false + t.string :survey_item_id, null: false t.string :prompt end - add_foreign_key :survey_items, :constructs + add_foreign_key :survey_items, :measures end end diff --git a/db/migrate/20210916143538_create_survey_item_responses.rb b/db/migrate/20210916143538_create_survey_item_responses.rb new file mode 100644 index 00000000..57b9022b --- /dev/null +++ b/db/migrate/20210916143538_create_survey_item_responses.rb @@ -0,0 +1,13 @@ +class CreateSurveyItemResponses < ActiveRecord::Migration[5.0] + def change + create_table :survey_item_responses do |t| + t.string :academic_year + t.integer :likert_score + t.integer :school_id, null: false + t.integer :survey_item_id, null: false + end + + add_foreign_key :survey_item_responses, :schools + add_foreign_key :survey_item_responses, :survey_items + end +end diff --git a/db/migrate/20210916143538_create_survey_responses.rb b/db/migrate/20210916143538_create_survey_responses.rb deleted file mode 100644 index d955cbb5..00000000 --- a/db/migrate/20210916143538_create_survey_responses.rb +++ /dev/null @@ -1,13 +0,0 @@ -class CreateSurveyResponses < ActiveRecord::Migration[5.0] - def change - create_table :survey_responses do |t| - t.string :academic_year - t.integer :likert_score - t.integer :school_id - t.integer :survey_item_id - end - - add_foreign_key :survey_responses, :schools - add_foreign_key :survey_responses, :survey_items - end -end diff --git a/db/migrate/20210920174840_create_sqm_categories.rb b/db/migrate/20210920174840_create_sqm_categories.rb new file mode 100644 index 00000000..96e114f0 --- /dev/null +++ b/db/migrate/20210920174840_create_sqm_categories.rb @@ -0,0 +1,7 @@ +class CreateSqmCategories < ActiveRecord::Migration[5.0] + def change + create_table :sqm_categories do |t| + t.string :name + end + end +end diff --git a/db/migrate/20210920174941_create_subcategories.rb b/db/migrate/20210920174941_create_subcategories.rb new file mode 100644 index 00000000..0bf4304f --- /dev/null +++ b/db/migrate/20210920174941_create_subcategories.rb @@ -0,0 +1,10 @@ +class CreateSubcategories < ActiveRecord::Migration[5.0] + def change + create_table :subcategories do |t| + t.string :name + t.integer :sqm_category_id + end + + add_foreign_key :subcategories, :sqm_categories + end +end diff --git a/db/migrate/20210920175116_add_foreign_key_from_measures_to_subcategories.rb b/db/migrate/20210920175116_add_foreign_key_from_measures_to_subcategories.rb new file mode 100644 index 00000000..7121fe17 --- /dev/null +++ b/db/migrate/20210920175116_add_foreign_key_from_measures_to_subcategories.rb @@ -0,0 +1,7 @@ +class AddForeignKeyFromMeasuresToSubcategories < ActiveRecord::Migration[5.0] + def change + add_column :measures, :subcategory_id, :integer, null: false + + add_foreign_key :measures, :subcategories + end +end diff --git a/db/schema.rb b/db/schema.rb index 496195b6..38f1d546 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20210917074250) do +ActiveRecord::Schema.define(version: 20210920175116) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -48,15 +48,6 @@ ActiveRecord::Schema.define(version: 20210917074250) do t.index ["slug"], name: "index_categories_on_slug", unique: true, using: :btree end - create_table "constructs", force: :cascade do |t| - t.string "construct_id" - t.string "name" - t.float "watch_low_benchmark" - t.float "growth_low_benchmark" - t.float "approval_low_benchmark" - t.float "ideal_low_benchmark" - end - create_table "districts", force: :cascade do |t| t.string "name" t.integer "state_id" @@ -66,6 +57,16 @@ ActiveRecord::Schema.define(version: 20210917074250) do t.index ["slug"], name: "index_districts_on_slug", unique: true, using: :btree end + create_table "measures", force: :cascade do |t| + t.string "measure_id", null: false + t.string "name" + t.float "watch_low_benchmark", null: false + t.float "growth_low_benchmark", null: false + t.float "approval_low_benchmark", null: false + t.float "ideal_low_benchmark", null: false + t.integer "subcategory_id", null: false + end + create_table "question_lists", force: :cascade do |t| t.string "name" t.text "description" @@ -193,6 +194,10 @@ ActiveRecord::Schema.define(version: 20210917074250) do t.index ["slug"], name: "index_schools_on_slug", unique: true, using: :btree end + create_table "sqm_categories", force: :cascade do |t| + t.string "name" + end + create_table "students", force: :cascade do |t| t.string "name" t.string "teacher" @@ -205,16 +210,22 @@ ActiveRecord::Schema.define(version: 20210917074250) do t.datetime "updated_at", null: false end - create_table "survey_items", force: :cascade do |t| - t.integer "construct_id" - t.string "prompt" + create_table "subcategories", force: :cascade do |t| + t.string "name" + t.integer "sqm_category_id" end - create_table "survey_responses", force: :cascade do |t| + create_table "survey_item_responses", force: :cascade do |t| t.string "academic_year" t.integer "likert_score" - t.integer "school_id" - t.integer "survey_item_id" + t.integer "school_id", null: false + t.integer "survey_item_id", null: false + end + + create_table "survey_items", force: :cascade do |t| + t.integer "measure_id", null: false + t.string "survey_item_id", null: false + t.string "prompt" end create_table "user_schools", force: :cascade do |t| @@ -242,11 +253,13 @@ ActiveRecord::Schema.define(version: 20210917074250) do t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree end + add_foreign_key "measures", "subcategories" add_foreign_key "recipient_lists", "schools" add_foreign_key "schedules", "schools" add_foreign_key "school_categories", "categories" add_foreign_key "school_categories", "schools" - add_foreign_key "survey_items", "constructs" - add_foreign_key "survey_responses", "schools" - add_foreign_key "survey_responses", "survey_items" + add_foreign_key "subcategories", "sqm_categories" + add_foreign_key "survey_item_responses", "schools" + add_foreign_key "survey_item_responses", "survey_items" + add_foreign_key "survey_items", "measures" end diff --git a/db/seeds.rb b/db/seeds.rb index 374cae41..73754c09 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -1,96 +1,38 @@ require 'csv' -SurveyItem.destroy_all -Construct.destroy_all - -csv_file = File.read(Rails.root.join('data', 'AY2020-21_construct_items.csv')) +csv_file = File.read(Rails.root.join('data', '2021-measure-key.csv')) CSV.parse(csv_file, headers: true).each do |row| - scale = row['Scale'] - unless scale.nil? - construct_id = row['Scale'].split(' ').first - construct_name = row['Scale'].remove("#{construct_id} ") + next if row['Source'] == 'Admin Data' + + category_name = row['Category'] + + if SqmCategory.find_by_name(category_name).nil? + SqmCategory.create name: category_name + end + + subcategory_name = row['Subcategory'] + + if Subcategory.find_by_name(subcategory_name).nil? + Subcategory.create sqm_category: SqmCategory.find_by_name(category_name), name: subcategory_name + end + + measure_id = row['Measure Id'] + + if Measure.find_by_measure_id(measure_id).nil? + measure_name = row['Measures'] watch_low = row['Watch Low'] growth_low = row['Growth Low'] approval_low = row['Approval Low'] ideal_low = row['Ideal Low'] - if Construct.find_by_construct_id(construct_id).nil? - Construct.create construct_id: construct_id, name: construct_name, watch_low_benchmark: watch_low, growth_low_benchmark: growth_low, approval_low_benchmark: approval_low, ideal_low_benchmark: ideal_low - end - - item_prompt = row['Survey Item'] - SurveyItem.create construct: Construct.find_by_construct_id(construct_id), prompt: item_prompt + Measure.create subcategory: Subcategory.find_by_name(subcategory_name), measure_id: measure_id, name: measure_name, watch_low_benchmark: watch_low, growth_low_benchmark: growth_low, approval_low_benchmark: approval_low, ideal_low_benchmark: ideal_low end -end -# questions = Category.find_by_name('Family Subcategory').child_categories.map(&:questions).flatten -# QuestionList.create(name: 'Family Questions', question_id_array: questions.map(&:id)) -# -# user = User.create(email: 'jared@edcontext.org', password: '123456') -# -# district = District.create(name: 'EdContext Test District') -# school = School.create(name: 'EdContext Test School', district: district, description: 'A school used to test the EdContext System') -# recipients = [ -# school.recipients.create(name: 'Jared Cosulich', phone: '650-269-3205'), -# school.recipients.create(name: 'Lauren Cosulich', phone: '6173522365'), -# school.recipients.create(name: 'Jack Schneider', phone: '+1 267-968-2293'), -# school.recipients.create(name: 'Lynisse Patin', phone: '19176566892'), -# school.recipients.create(name: 'Khemenec Patin', phone: '(347) 534-6437'), -# ] -# -# recipients[0].students.create(name: 'Abigail') -# recipients[0].students.create(name: 'Clara') -# -# recipients[3].students.create(name: 'Zara') -# recipients[3].students.create(name: 'Cole') -# recipients[4].students.create(name: 'Zara') -# recipients[4].students.create(name: 'Cole') -# -# recipient_list = school.recipient_lists.create(name: 'Pilot Parent Test', recipient_id_array: recipients.map(&:id)) -# -# user.user_schools.create(school: school) + survey_item_id = row['Survey Item ID'] -# somerville = District.create(name: 'Somerville Public Schools') -# -# [ -# ['Dr. Albert F. Argenziano School at Lincoln Park', -# """ -# The Dr. Albert F. Argenziano School at Lincoln Park is driven by the mission of supporting and fostering an educational and communal environment that results in the development of students who are literate in all subject areas, experienced in current technologies, and who think critically, behave ethically, lead healthy lives, and assume the responsibilities of citizenship in a multicultural and multiracial society. Opened in September 2007, this state-of-the-art facility features upgraded classrooms, a gymnasium, a multi-purpose cafeteria, a library/media center, and a math/science technology center. The Argenziano School at Lincoln Park also serves as the home of the District’s Structured English Immersion Program (SEIP), offering intensive instruction for English Language Learners, including integrated model classrooms in the early grades. -# """ -# ], [ -# 'Arthur D. Healey School', -# """ -# The Arthur D. Healey School is an innovative, participatory learning community that places a high value on academic competence and the belief that children learn best in a joyful, creative environment in which their natural curiosity, imagination and thinking are encouraged. The school emphasizes learning through creative experiences of project-based learning, arts integration, service learning integration and off-site learning. Learning experiences are designed to engage children’s interest and best efforts, and to promote the importance of community in the lives of children. The Healey School celebrates diversity through its core values of excellence, joy, openness and creativity. -# """ -# ], [ -# 'Benjamin G. Brown School', -# """ -# Built in 1900 and named for Tufts faculty member, the Benjamin G. Brown School is the oldest elementary school in Somerville, and the smallest of the Somerville Public Schools’ elementary schools. The Brown School offers a small school family atmosphere with a strong emphasis on preparing students to excel academically and personally, providing them with the tools to become productive and positive members of society. Teachers participate in professional development endeavors to develop and create engaging teaching strategies that will meet the individual learning needs of their students. Creative learning experiences and a focus on multi-grade relationships like learning buddies and academic mentors, help keep students engaged in their learning and in their community. -# """ -# ], [ -# 'East Somerville Community School', -# """ -# The East Somerville Community School (ESCS) is a diverse learning community in an ethnically rich neighborhood. ESCS’s instructional focus is a school and community-wide effort to increase students’ ability to write to express their thinking and learning across the content areas as measured by the MCAS and school based common assessments. The building, constructed in 2013, features state-of-the-art technology, a beautiful auditorium, child-friendly recreation facilities, outdoor learning environments including a school garden courtyard, energy-saving features, and much more. ESCS is also home to the District’s UNIDOS program, a two-way English/Spanish language and cultural immersion program that enrolls native speakers of English and Spanish to learn together 50% of the day in Spanish and 50% in English. -# """ -# ], [ -# 'John F. Kennedy Elementary School', -# """ -# Somerville’s John F. Kennedy School is driven by the goal of providing all students with academic, social and emotional experiences necessary for future success. The school places a strong emphasis on inclusion, ensuring that all students with special needs can thrive in the general education setting. The Kennedy School is a MA Department of Elementary and Secondary Education Level 1 school, the highest rating in the state’s 5-level accountability rating system. Service learning and History also play prominently in a Kennedy students’ learning experience. Kennedy middle grades students regularly compete in regional, statewide and national History Day competitions, and students at all grade levels have opportunities to learn the value of making a positive difference in their community by engaging in service learning activities throughout the year. -# """ -# ], [ -# 'Somerville High School', -# """ -# Somerville High School (SHS) is a comprehensive high school that blends a rigorous core academic program with cutting-edge Career and Technical Education program. SHS is a Level 1 school on the state accountability rating, and has been recognized by public and private organizations for its achievements. SHS also celebrates a diverse student body, where more than 50 different languages are represented, and classroom experiences regularly connect students with industry and community partners. Along with a rigorous core curriculum, students also benefit from a full complement of Honors and Advanced Placement courses, a complement of World Language courses, a wide range of Art and Music programs, and a rich after-school life that includes athletic, extracurricular and community activities. -# """ -# ], [ -# 'West Somerville Neighborhood School', -# """ -# Staff, parents/guardians and the community of the West Somerville Neighborhood School (WSNS) collaborate for the development of the whole child. The WSNS maintains high expectations for academic achievement and appropriate behavior with mutual respect. In 2014 and 2015, WSNS earned Level 1 designation by the DESE, the highest accountability rating in the state’s 5-level rating system. WSNS focuses on building student writing skills as a way of synthesizing thinking and nurturing creative expression. The school strives to extend and improve students’ learning through the use of assessments, differentiated instruction, the use of technology and interdisciplinary projects. The ultimate goal is to develop students with skills to become independent and self-sufficient adults who contribute responsibly in a global economy. -# """ -# ], [ -# 'Winter Hill Community Innovation School', -# """ -# The Winter Hill Community Innovation School (WHCIS) is a child-centered, academically rich environment that serves a population of students from culturally diverse backgrounds. As part of the school’s collaborative approach to teaching and learning, teachers regularly have one on one conferences with students to assess progress and mutually set goals. In 2014, the WHCIS advanced to Level 2 status on the state’s 5-level accountability rating system. Winter Hill is the district’s first school to receive “Innovation School” designation from the state. As part of its Innovation status, WHCIS enjoys increased autonomy and has been introducing new educational practices to support its vision of using innovative approaches to better meet the varied needs of a highly diverse range of learners. -# """ -# ]].each do |school_info| -# School.create(name: school_info[0], district: somerville, description: school_info[1]) -# end + next if survey_item_id.nil? + + if SurveyItem.find_by_survey_item_id(survey_item_id).nil? + item_prompt = row['Revised Question'].nil? ? row['Question/Item'] : row['Revised Question'] + SurveyItem.create measure: Measure.find_by_measure_id(measure_id), prompt: item_prompt, survey_item_id: survey_item_id + end +end diff --git a/spec/features/school_dashboard_feature_spec.rb b/spec/features/school_dashboard_feature_spec.rb index 10063f20..28e7ab9f 100644 --- a/spec/features/school_dashboard_feature_spec.rb +++ b/spec/features/school_dashboard_feature_spec.rb @@ -4,18 +4,18 @@ feature "School dashboard", type: feature do let(:district) { District.create name: 'Winchester' } let(:school) { School.create name: 'Winchester High School', slug: 'winchester-high-school', district: district } - let(:construct) { Construct.find_by_construct_id('1A-i') } + let(:measure) { Measure.find_by_measure_id('1A-i') } - let(:survey_item_1_for_construct) { SurveyItem.create construct: construct } - let(:survey_item_2_for_construct) { SurveyItem.create construct: construct } + let(:survey_item_1_for_measure) { SurveyItem.create measure: measure, survey_item_id: '1' } + let(:survey_item_2_for_measure) { SurveyItem.create measure: measure, survey_item_id: '2' } - let(:construct_row_bars) { page.all('rect.construct-row-bar') } + let(:measure_row_bars) { page.all('rect.measure-row-bar') } let(:ay_2020_21) { '2020-21' } before :each do - SurveyResponse.create academic_year: ay_2020_21, school: school, survey_item: survey_item_1_for_construct, likert_score: 4 - SurveyResponse.create academic_year: ay_2020_21, school: school, survey_item: survey_item_2_for_construct, likert_score: 5 + SurveyItemResponse.create academic_year: ay_2020_21, school: school, survey_item: survey_item_1_for_measure, likert_score: 4 + SurveyItemResponse.create academic_year: ay_2020_21, school: school, survey_item: survey_item_2_for_measure, likert_score: 5 end scenario "User authentication fails" do @@ -37,8 +37,8 @@ feature "School dashboard", type: feature do expect(page).to have_text(school.name) expect(page).to have_text('Professional Qualifications') - first_row_bar = construct_row_bars.first - expect(first_row_bar['width']).to eq '179' + first_row_bar = measure_row_bars.first + expect(first_row_bar['width']).to eq '20.66%' end let(:username) { 'winchester' } diff --git a/spec/models/construct_spec.rb b/spec/models/construct_spec.rb deleted file mode 100644 index d4470cfb..00000000 --- a/spec/models/construct_spec.rb +++ /dev/null @@ -1,45 +0,0 @@ -require 'rails_helper' - -describe Construct, type: :model do - it('has all the constructs') do - expect(Construct.count).to eq 34 - end - - it 'returns the construct for the given construct id' do - construct = Construct.find_by_construct_id('1A-i') - - expect(construct.name).to eq 'Professional Qualifications' - expect(construct.warning_zone).to eq Construct::Zone.new(1.0, 2.49, :warning) - expect(construct.watch_zone).to eq Construct::Zone.new(2.49, 3.0, :watch) - expect(construct.growth_zone).to eq Construct::Zone.new(3.0, 3.5, :growth) - expect(construct.approval_zone).to eq Construct::Zone.new(3.5, 4.71, :approval) - expect(construct.ideal_zone).to eq Construct::Zone.new(4.71, 5.0, :ideal) - end - - describe '#zone_for_score' do - let(:construct) { - Construct.new watch_low_benchmark: 1.5, growth_low_benchmark: 2.5, approval_low_benchmark: 3.5, ideal_low_benchmark: 4.5 - } - - context 'when the score is 1.0' do - it 'returns the warning zone' do - expect(construct.zone_for_score(1.0)).to eq construct.warning_zone - end - end - - context 'when the score is 5.0' do - it 'returns the ideal zone' do - expect(construct.zone_for_score(5.0)).to eq construct.ideal_zone - end - end - - context 'when the score is right on the benchmark' do - it 'returns the higher zone' do - expect(construct.zone_for_score(1.5)).to eq construct.watch_zone - expect(construct.zone_for_score(2.5)).to eq construct.growth_zone - expect(construct.zone_for_score(3.5)).to eq construct.approval_zone - expect(construct.zone_for_score(4.5)).to eq construct.ideal_zone - end - end - end -end diff --git a/spec/models/measure_spec.rb b/spec/models/measure_spec.rb new file mode 100644 index 00000000..bee568de --- /dev/null +++ b/spec/models/measure_spec.rb @@ -0,0 +1,45 @@ +require 'rails_helper' + +describe Measure, type: :model do + it('has all the measures') do + expect(Measure.count).to eq 30 + end + + it 'returns the measure for the given measure id' do + measure = Measure.find_by_measure_id('1A-i') + + expect(measure.name).to eq 'Professional Qualifications' + expect(measure.warning_zone).to eq Measure::Zone.new(1.0, 2.49, :warning) + expect(measure.watch_zone).to eq Measure::Zone.new(2.49, 3.0, :watch) + expect(measure.growth_zone).to eq Measure::Zone.new(3.0, 3.5, :growth) + expect(measure.approval_zone).to eq Measure::Zone.new(3.5, 4.71, :approval) + expect(measure.ideal_zone).to eq Measure::Zone.new(4.71, 5.0, :ideal) + end + + describe '#zone_for_score' do + let(:measure) { + Measure.new watch_low_benchmark: 1.5, growth_low_benchmark: 2.5, approval_low_benchmark: 3.5, ideal_low_benchmark: 4.5 + } + + context 'when the score is 1.0' do + it 'returns the warning zone' do + expect(measure.zone_for_score(1.0)).to eq measure.warning_zone + end + end + + context 'when the score is 5.0' do + it 'returns the ideal zone' do + expect(measure.zone_for_score(5.0)).to eq measure.ideal_zone + end + end + + context 'when the score is right on the benchmark' do + it 'returns the higher zone' do + expect(measure.zone_for_score(1.5)).to eq measure.watch_zone + expect(measure.zone_for_score(2.5)).to eq measure.growth_zone + expect(measure.zone_for_score(3.5)).to eq measure.approval_zone + expect(measure.zone_for_score(4.5)).to eq measure.ideal_zone + end + end + end +end diff --git a/spec/models/survey_item_spec.rb b/spec/models/survey_item_spec.rb index 617ce641..a193c64d 100644 --- a/spec/models/survey_item_spec.rb +++ b/spec/models/survey_item_spec.rb @@ -2,6 +2,6 @@ require 'rails_helper' describe SurveyItem, type: :model do it('has all the questions') do - expect(SurveyItem.count).to eq 153 + expect(SurveyItem.count).to eq 137 end end diff --git a/spec/models/survey_response_aggregator_spec.rb b/spec/models/survey_response_aggregator_spec.rb index dff8f180..1446e522 100644 --- a/spec/models/survey_response_aggregator_spec.rb +++ b/spec/models/survey_response_aggregator_spec.rb @@ -1,60 +1,63 @@ require 'rails_helper' describe SurveyResponseAggregator, type: :model do + let(:category) { SqmCategory.create } + let(:subcategory) { Subcategory.create sqm_category: category } + let(:ay_2020_21) { '2020-21' } let(:ay_2021_22) { '2021-22' } let(:school_a) { School.create name: 'School A' } let(:school_b) { School.create name: 'School A' } - let(:construct_a) { Construct.create name: 'Construct A', construct_id: 'construct-a-id' } - let(:construct_b) { Construct.create name: 'Construct B', construct_id: 'construct-b-id' } + let(:measure_a) { Measure.create subcategory: subcategory, name: 'Measure A', measure_id: 'measure-a-id', watch_low_benchmark: 1.1, growth_low_benchmark: 2, approval_low_benchmark: 3, ideal_low_benchmark: 4 } + let(:measure_b) { Measure.create subcategory: subcategory, name: 'Measure B', measure_id: 'measure-b-id', watch_low_benchmark: 1.1, growth_low_benchmark: 2, approval_low_benchmark: 3, ideal_low_benchmark: 4 } - let(:survey_item_1_for_construct_a) { SurveyItem.create construct: construct_a } - let(:survey_item_2_for_construct_a) { SurveyItem.create construct: construct_a } + let(:survey_item_1_for_measure_a) { SurveyItem.create measure: measure_a, survey_item_id: 'si1a' } + let(:survey_item_2_for_measure_a) { SurveyItem.create measure: measure_a, survey_item_id: 'si2a' } - let(:survey_item_1_for_construct_b) { SurveyItem.create construct: construct_b } - let(:survey_item_2_for_construct_b) { SurveyItem.create construct: construct_b } + let(:survey_item_1_for_measure_b) { SurveyItem.create measure: measure_b, survey_item_id: 'si1b' } + let(:survey_item_2_for_measure_b) { SurveyItem.create measure: measure_b, survey_item_id: 'si2b' } before :each do - SurveyResponse.create academic_year: ay_2020_21, school: school_a, survey_item: survey_item_1_for_construct_a, likert_score: 1 - SurveyResponse.create academic_year: ay_2020_21, school: school_a, survey_item: survey_item_2_for_construct_a, likert_score: 2 + SurveyItemResponse.create academic_year: ay_2020_21, school: school_a, survey_item: survey_item_1_for_measure_a, likert_score: 1 + SurveyItemResponse.create academic_year: ay_2020_21, school: school_a, survey_item: survey_item_2_for_measure_a, likert_score: 2 - SurveyResponse.create academic_year: ay_2020_21, school: school_a, survey_item: survey_item_1_for_construct_b, likert_score: 1 - SurveyResponse.create academic_year: ay_2020_21, school: school_a, survey_item: survey_item_2_for_construct_b, likert_score: 3 + SurveyItemResponse.create academic_year: ay_2020_21, school: school_a, survey_item: survey_item_1_for_measure_b, likert_score: 1 + SurveyItemResponse.create academic_year: ay_2020_21, school: school_a, survey_item: survey_item_2_for_measure_b, likert_score: 3 - SurveyResponse.create academic_year: ay_2020_21, school: school_b, survey_item: survey_item_1_for_construct_a, likert_score: 1 - SurveyResponse.create academic_year: ay_2020_21, school: school_b, survey_item: survey_item_2_for_construct_a, likert_score: 4 + SurveyItemResponse.create academic_year: ay_2020_21, school: school_b, survey_item: survey_item_1_for_measure_a, likert_score: 1 + SurveyItemResponse.create academic_year: ay_2020_21, school: school_b, survey_item: survey_item_2_for_measure_a, likert_score: 4 - SurveyResponse.create academic_year: ay_2020_21, school: school_b, survey_item: survey_item_1_for_construct_b, likert_score: 1 - SurveyResponse.create academic_year: ay_2020_21, school: school_b, survey_item: survey_item_2_for_construct_b, likert_score: 5 + SurveyItemResponse.create academic_year: ay_2020_21, school: school_b, survey_item: survey_item_1_for_measure_b, likert_score: 1 + SurveyItemResponse.create academic_year: ay_2020_21, school: school_b, survey_item: survey_item_2_for_measure_b, likert_score: 5 - SurveyResponse.create academic_year: ay_2021_22, school: school_a, survey_item: survey_item_1_for_construct_a, likert_score: 2 - SurveyResponse.create academic_year: ay_2021_22, school: school_a, survey_item: survey_item_2_for_construct_a, likert_score: 3 + SurveyItemResponse.create academic_year: ay_2021_22, school: school_a, survey_item: survey_item_1_for_measure_a, likert_score: 2 + SurveyItemResponse.create academic_year: ay_2021_22, school: school_a, survey_item: survey_item_2_for_measure_a, likert_score: 3 - SurveyResponse.create academic_year: ay_2021_22, school: school_a, survey_item: survey_item_1_for_construct_b, likert_score: 2 - SurveyResponse.create academic_year: ay_2021_22, school: school_a, survey_item: survey_item_2_for_construct_b, likert_score: 4 + SurveyItemResponse.create academic_year: ay_2021_22, school: school_a, survey_item: survey_item_1_for_measure_b, likert_score: 2 + SurveyItemResponse.create academic_year: ay_2021_22, school: school_a, survey_item: survey_item_2_for_measure_b, likert_score: 4 - SurveyResponse.create academic_year: ay_2021_22, school: school_b, survey_item: survey_item_1_for_construct_a, likert_score: 2 - SurveyResponse.create academic_year: ay_2021_22, school: school_b, survey_item: survey_item_2_for_construct_a, likert_score: 5 + SurveyItemResponse.create academic_year: ay_2021_22, school: school_b, survey_item: survey_item_1_for_measure_a, likert_score: 2 + SurveyItemResponse.create academic_year: ay_2021_22, school: school_b, survey_item: survey_item_2_for_measure_a, likert_score: 5 - SurveyResponse.create academic_year: ay_2021_22, school: school_b, survey_item: survey_item_1_for_construct_b, likert_score: 3 - SurveyResponse.create academic_year: ay_2021_22, school: school_b, survey_item: survey_item_2_for_construct_b, likert_score: 5 + SurveyItemResponse.create academic_year: ay_2021_22, school: school_b, survey_item: survey_item_1_for_measure_b, likert_score: 3 + SurveyItemResponse.create academic_year: ay_2021_22, school: school_b, survey_item: survey_item_2_for_measure_b, likert_score: 5 end describe '.score' do - it 'returns the average score of the survey responses for the given school, academic year, and construct' do - expect(SurveyResponseAggregator.score(academic_year: ay_2020_21, school: school_a, construct: construct_a)).to eq 1.5 - expect(SurveyResponseAggregator.score(academic_year: ay_2020_21, school: school_a, construct: construct_b)).to eq 2.0 + it 'returns the average score of the survey responses for the given school, academic year, and measure' do + expect(SurveyResponseAggregator.score(academic_year: ay_2020_21, school: school_a, measure: measure_a)).to eq 1.5 + expect(SurveyResponseAggregator.score(academic_year: ay_2020_21, school: school_a, measure: measure_b)).to eq 2.0 - expect(SurveyResponseAggregator.score(academic_year: ay_2020_21, school: school_b, construct: construct_a)).to eq 2.5 - expect(SurveyResponseAggregator.score(academic_year: ay_2020_21, school: school_b, construct: construct_b)).to eq 3.0 + expect(SurveyResponseAggregator.score(academic_year: ay_2020_21, school: school_b, measure: measure_a)).to eq 2.5 + expect(SurveyResponseAggregator.score(academic_year: ay_2020_21, school: school_b, measure: measure_b)).to eq 3.0 - expect(SurveyResponseAggregator.score(academic_year: ay_2021_22, school: school_a, construct: construct_a)).to eq 2.5 - expect(SurveyResponseAggregator.score(academic_year: ay_2021_22, school: school_a, construct: construct_b)).to eq 3.0 + expect(SurveyResponseAggregator.score(academic_year: ay_2021_22, school: school_a, measure: measure_a)).to eq 2.5 + expect(SurveyResponseAggregator.score(academic_year: ay_2021_22, school: school_a, measure: measure_b)).to eq 3.0 - expect(SurveyResponseAggregator.score(academic_year: ay_2021_22, school: school_b, construct: construct_a)).to eq 3.5 - expect(SurveyResponseAggregator.score(academic_year: ay_2021_22, school: school_b, construct: construct_b)).to eq 4.0 + expect(SurveyResponseAggregator.score(academic_year: ay_2021_22, school: school_b, measure: measure_a)).to eq 3.5 + expect(SurveyResponseAggregator.score(academic_year: ay_2021_22, school: school_b, measure: measure_b)).to eq 4.0 end end end diff --git a/spec/presenters/construct_graph_row_presenter_spec.rb b/spec/presenters/measure_graph_row_presenter_spec.rb similarity index 68% rename from spec/presenters/construct_graph_row_presenter_spec.rb rename to spec/presenters/measure_graph_row_presenter_spec.rb index af56dd4d..79f1e934 100644 --- a/spec/presenters/construct_graph_row_presenter_spec.rb +++ b/spec/presenters/measure_graph_row_presenter_spec.rb @@ -1,14 +1,14 @@ require 'rails_helper' -RSpec.describe "construct graph row presenter" do +RSpec.describe MeasureGraphRowPresenter do let(:watch_low_benchmark) { 2.9 } let(:growth_low_benchmark) { 3.1 } let(:approval_low_benchmark) { 3.6 } let(:ideal_low_benchmark) { 3.8 } - let(:construct) { - Construct.new( + let(:measure) { + Measure.new( name: 'Some Title', watch_low_benchmark: watch_low_benchmark, growth_low_benchmark: growth_low_benchmark, @@ -18,22 +18,22 @@ RSpec.describe "construct graph row presenter" do } let(:presenter) { - ConstructGraphRowPresenter.new construct: construct, score: score + MeasureGraphRowPresenter.new measure: measure, score: score } - shared_examples_for 'construct_title' do - it('returns the construct title') do - expect(presenter.construct_name).to eq 'Some Title' + shared_examples_for 'measure_name' do + it('returns the measure name') do + expect(presenter.measure_name).to eq 'Some Title' end end context('when the score is in the Ideal zone') do let(:score) { 4.4 } - it_behaves_like 'construct_title' + it_behaves_like 'measure_name' it('returns the correct color') do - expect(presenter.bar_color).to eq ConstructGraphParameters::ZoneColor::IDEAL + expect(presenter.bar_color).to eq MeasureGraphParameters::ZoneColor::IDEAL end it('returns a bar width equal to the approval zone width plus the proportionate ideal zone width') do @@ -48,10 +48,10 @@ RSpec.describe "construct graph row presenter" do context('when the score is in the Approval zone') do let(:score) { 3.7 } - it_behaves_like 'construct_title' + it_behaves_like 'measure_name' it("returns the correct color") do - expect(presenter.bar_color).to eq ConstructGraphParameters::ZoneColor::APPROVAL + expect(presenter.bar_color).to eq MeasureGraphParameters::ZoneColor::APPROVAL end it('returns a bar width equal to the proportionate approval zone width') do @@ -66,10 +66,10 @@ RSpec.describe "construct graph row presenter" do context('when the score is in the Growth zone') do let(:score) { 3.2 } - it_behaves_like 'construct_title' + it_behaves_like 'measure_name' it("returns the correct color") do - expect(presenter.bar_color).to eq ConstructGraphParameters::ZoneColor::GROWTH + expect(presenter.bar_color).to eq MeasureGraphParameters::ZoneColor::GROWTH end it('returns a bar width equal to the proportionate growth zone width') do @@ -84,14 +84,14 @@ RSpec.describe "construct graph row presenter" do context('when the score is in the Watch zone') do let(:score) { 3.0 } - it_behaves_like 'construct_title' + it_behaves_like 'measure_name' it("returns the correct color") do - expect(presenter.bar_color).to eq ConstructGraphParameters::ZoneColor::WATCH + expect(presenter.bar_color).to eq MeasureGraphParameters::ZoneColor::WATCH end it('returns a bar width equal to the proportionate watch zone width plus the growth zone width') do - expect(presenter.bar_width).to eq "25.01%" + expect(presenter.bar_width).to eq "25.0%" end it('returns an x-offset equal to the bar width') do @@ -102,18 +102,18 @@ RSpec.describe "construct graph row presenter" do context('when the score is in the Warning zone') do let(:score) { 2.8 } - it_behaves_like 'construct_title' + it_behaves_like 'measure_name' it("returns the correct color") do - expect(presenter.bar_color).to eq ConstructGraphParameters::ZoneColor::WARNING + expect(presenter.bar_color).to eq MeasureGraphParameters::ZoneColor::WARNING end it('returns a bar width equal to the proportionate warning zone width plus the watch & growth zone widths') do - expect(presenter.bar_width).to eq "49.13%" + expect(presenter.bar_width).to eq "49.12%" end it('returns an x-offset equal to the bar width') do - expect(presenter.x_offset).to eq "0.87%" + expect(presenter.x_offset).to eq "0.88%" end end end