From ee41751f4e2c5f36977435fa288ef9d635b49a1b Mon Sep 17 00:00:00 2001 From: Nelson Jovel Date: Wed, 26 Jun 2024 12:02:22 -0700 Subject: [PATCH] chore: correct parsing for 'not sped' and 'lep not first year' --- app/models/ell.rb | 2 +- app/models/sped.rb | 4 ++-- app/models/subcategory.rb | 1 - spec/services/survey_item_values_spec.rb | 11 +++++++++++ 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/app/models/ell.rb b/app/models/ell.rb index 018d5df7..4cf578fd 100644 --- a/app/models/ell.rb +++ b/app/models/ell.rb @@ -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" diff --git a/app/models/sped.rb b/app/models/sped.rb index 01fe0bfa..b132aeb9 100644 --- a/app/models/sped.rb +++ b/app/models/sped.rb @@ -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 "************************************" diff --git a/app/models/subcategory.rb b/app/models/subcategory.rb index 72ca95f4..907a0777 100644 --- a/app/models/subcategory.rb +++ b/app/models/subcategory.rb @@ -59,7 +59,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 diff --git a/spec/services/survey_item_values_spec.rb b/spec/services/survey_item_values_spec.rb index 0bbdbe64..7e70d462 100644 --- a/spec/services/survey_item_values_spec.rb +++ b/spec/services/survey_item_values_spec.rb @@ -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" }