chore: correct parsing for 'not sped' and 'lep not first year'

mciea-main
Nelson Jovel 1 year ago
parent 1d95b74707
commit 2c4dec050e

@ -9,7 +9,7 @@ class Ell < ApplicationRecord
ell = ell.delete(",")
case ell
in /lep\s*student\s*1st\s*year|LEP\s*student\s*not\s*1st\s*year|EL\s*Student\s*First\s*Year|LEP\s*student|^EL\s+|true|1|^ELL$/i
in /lep\s*student\s*1st\s*year|LEP\s*student\s*not\s*1st\s*year|EL\s*Student\s*First\s*Year|LEP\s*student|^EL\s+|true|1|^ELL$|^LEP\s*Not\s*1st\s*Year/i
"ELL"
in /0|2|3|Does\s*not\s*apply/i
"Not ELL"

@ -10,9 +10,9 @@ class Sped < ApplicationRecord
case sped
in /active|^A$|1|^Special\s*Education$/i
"Special Education"
in /^I$|exited|0|^Not\s*Special\s*Education$|Does\s*not\s*apply|Referred|Ineligible|^No\s*special\s*needs$/i
in /^I$|exited|0|^Not\s*Special\s*Education$|Does\s*not\s*apply|Referred|Ineligible|^No\s*special\s*needs$|Not\s*SPED/i
"Not Special Education"
in %r{^#*N/*A$|Unknown|SpecialEdStatus|SPED}i
in %r{^#*N/*A$|^Unknown|^SpecialEdStatus|^SPED}i
"Unknown"
else
puts "************************************"

@ -41,7 +41,6 @@ class Subcategory < ActiveRecord::Base
teacher_response_rate: teacher.rate, meets_student_threshold: student.meets_student_threshold?,
meets_teacher_threshold: teacher.meets_teacher_threshold?)
end
@response_rate[[school, academic_year]]
end

@ -1,6 +1,4 @@
require 'rails_helper'
include Analyze::Graph::Column::GenderColumn
require "rails_helper"
RSpec.describe Analyze::Graph::Column::GenderColumn::Unknown, type: :model do
let(:school) { create(:school) }
@ -11,65 +9,65 @@ RSpec.describe Analyze::Graph::Column::GenderColumn::Unknown, type: :model do
let(:number_of_columns) { 1 }
let(:gender) { create(:gender, qualtrics_code: 99) }
let(:subcategory) { create(:subcategory, subcategory_id: '1A') }
let(:measure) { create(:measure, measure_id: '1A-iii', subcategory:) }
let(:subcategory) { create(:subcategory, subcategory_id: "1A") }
let(:measure) { create(:measure, measure_id: "1A-iii", subcategory:) }
let(:scale) { create(:student_scale, measure:) }
let(:survey_item) { create(:student_survey_item, scale:) }
let(:teacher_scale) { create(:teacher_scale, measure:) }
let(:teacher_survey_item) { create(:teacher_survey_item, scale:) }
context 'when no teacher responses exist' do
context 'when there are insufficient unknown students' do
it 'reports a score of 3 when the average is 3' do
context "when no teacher responses exist" do
context "when there are insufficient unknown students" do
it "reports a score of 3 when the average is 3" do
expect(Analyze::Graph::Column::GenderColumn::Unknown.new(school:, academic_years:, position:, measure:,
number_of_columns:).score(0).average).to eq(nil)
number_of_columns:).score(academic_year).average).to eq(nil)
end
it 'reports insufficient data' do
it "reports insufficient data" do
expect(Analyze::Graph::Column::GenderColumn::Unknown.new(school:, academic_years:, position:, measure:,
number_of_columns:).sufficient_student_responses?(academic_year:)).to eq(false)
end
end
context 'when there are sufficient unknown students' do
before do
context "when there are sufficient unknown students" do
before :each do
create_list(:survey_item_response, 10, school:, academic_year:, gender:, survey_item:)
end
it 'reports a score of 3 when the average is 3' do
it "reports a score of 3 when the average is 3" do
expect(Analyze::Graph::Column::GenderColumn::Unknown.new(school:, academic_years:, position:, measure:,
number_of_columns:).score(0).average).to eq(3)
number_of_columns:).score(academic_year).average).to eq(3)
end
it 'reports sufficient data' do
it "reports sufficient data" do
expect(Analyze::Graph::Column::GenderColumn::Unknown.new(school:, academic_years:, position:, measure:,
number_of_columns:).sufficient_student_responses?(academic_year:)).to eq(true)
end
end
end
context 'when teacher responses exist' do
before do
context "when teacher responses exist" do
before :each do
create_list(:survey_item_response, 10, school:, academic_year:, survey_item: teacher_survey_item, likert_score: 5)
end
context 'when there are insufficient unknown students' do
it 'reports a score of 3 when the average is 3' do
context "when there are insufficient unknown students" do
it "reports a score of 3 when the average is 3" do
expect(Analyze::Graph::Column::GenderColumn::Unknown.new(school:, academic_years:, position:, measure:,
number_of_columns:).score(0).average).to eq(nil)
number_of_columns:).score(academic_year).average).to eq(nil)
end
it 'reports insufficient data' do
it "reports insufficient data" do
expect(Analyze::Graph::Column::GenderColumn::Unknown.new(school:, academic_years:, position:, measure:,
number_of_columns:).sufficient_student_responses?(academic_year:)).to eq(false)
end
end
context 'when there are sufficient unknown students' do
before do
context "when there are sufficient unknown students" do
before :each do
create_list(:survey_item_response, 10, school:, academic_year:, gender:, survey_item:)
end
it 'reports a score of 3 when the average is 3' do
it "reports a score of 3 when the average is 3" do
expect(Analyze::Graph::Column::GenderColumn::Unknown.new(school:, academic_years:, position:, measure:,
number_of_columns:).score(0).average).to eq(3)
number_of_columns:).score(academic_year).average).to eq(3)
end
it 'reports sufficient data' do
it "reports sufficient data" do
expect(Analyze::Graph::Column::GenderColumn::Unknown.new(school:, academic_years:, position:, measure:,
number_of_columns:).sufficient_student_responses?(academic_year:)).to eq(true)
end

@ -579,6 +579,10 @@ RSpec.describe SurveyItemValues, type: :model do
row = { "Raw ELL" => "EL - Early Child. or PK" }
values = SurveyItemValues.new(row:, headers:, survey_items:, schools:)
expect(values.ell).to eq "ELL"
row = { "Raw ELL" => "LEP Not 1st Year" }
values = SurveyItemValues.new(row:, headers:, survey_items:, schools:)
expect(values.ell).to eq "ELL"
end
it 'translates "Does not Apply" into "Not ELL"' do
@ -680,6 +684,13 @@ RSpec.describe SurveyItemValues, type: :model do
expect(values.sped).to eq "Not Special Education"
end
it 'translates "not sped" into "Not Special Education' do
headers = ["Raw SpEd"]
row = { "Raw SpEd" => "Not SPED" }
values = SurveyItemValues.new(row:, headers:, survey_items:, schools:, academic_years:)
expect(values.sped).to eq "Not Special Education"
end
it 'translates NA into "Unknown"' do
headers = ["Raw SpEd"]
row = { "Raw SpEd" => "NA" }

Loading…
Cancel
Save