feat: add esp counts when calculating teacher participation rates on overview page

This commit is contained in:
Nelson Jovel 2025-01-15 13:39:41 -08:00 committed by rebuilt
parent 2f4d0bb56b
commit 534f42dfe0
11 changed files with 131 additions and 2 deletions

12
spec/fixtures/sample_esp_counts.csv vendored Normal file
View file

@ -0,0 +1,12 @@
DESE ID,Academic Year,School Name,School Totals
3440045,2024-25,Ambrose,16
3440005,2024-25,Lincoln,11
3440020,2024-25,Lynch ,25
3440040,2024-25,Muraco,15
3440025,2024-25,VO,18
3440305,2024-25,McCall,14
3440505,2024-25,WHS,14
1850505,2024-25,Milford High School,18
3010020,2024-25,Tyngsborough Elementary School,29
3010305,2024-25,Tyngsborough Middle School,6
3010505,2024-25,Tyngsborough Hight School,2
1 DESE ID Academic Year School Name School Totals
2 3440045 2024-25 Ambrose 16
3 3440005 2024-25 Lincoln 11
4 3440020 2024-25 Lynch 25
5 3440040 2024-25 Muraco 15
6 3440025 2024-25 VO 18
7 3440305 2024-25 McCall 14
8 3440505 2024-25 WHS 14
9 1850505 2024-25 Milford High School 18
10 3010020 2024-25 Tyngsborough Elementary School 29
11 3010305 2024-25 Tyngsborough Middle School 6
12 3010505 2024-25 Tyngsborough Hight School 2

View file

@ -142,6 +142,40 @@ describe Seeder do
# end
# end
context "esp counts" do
context "when esp counts are loaded from a file" do
before :each do
create(:school, dese_id: 3_440_045, name: "Ambrose")
create(:school, dese_id: 3_440_005, name: "Lincoln")
create(:school, dese_id: 3_440_020, name: "Lynch")
create(:school, dese_id: 3_440_040, name: "Muraco")
create(:school, dese_id: 3_440_025, name: "VO")
create(:school, dese_id: 3_440_305, name: "McCall Elementary")
create(:school, dese_id: 3_440_505, name: "WHS")
create(:school, dese_id: 1_850_505, name: "Milford")
create(:school, dese_id: 3_010_020, name: "Tyngsborough Elemenatary")
create(:school, dese_id: 3_010_305, name: "Tyngsborough Middle")
create(:school, dese_id: 3_010_505, name: "Tyngsborough High")
create(:academic_year, range: "2024-25 Fall")
create(:academic_year, range: "2024-25 Spring")
seeder.seed_esp_counts(sample_esp_csv)
end
it "loads esp information into the database" do
fall = AcademicYear.find_by_range("2024-25 Fall")
spring = AcademicYear.find_by_range("2024-25 Spring")
ambrose = School.find_by_dese_id 3_440_045
respondents = Respondent.find_by(school: ambrose, academic_year: fall)
expect(respondents.total_esp).to eq 16
respondents = Respondent.find_by(school: ambrose, academic_year: spring)
expect(respondents.total_esp).to eq 16
end
end
end
context "admin data items" do
context "when deprecated admin items exist in the database" do
before :each do
@ -273,4 +307,8 @@ describe Seeder do
def sample_sqm_framework_csv
Rails.root.join("spec", "fixtures", "sample_sqm_framework.csv")
end
def sample_esp_csv
Rails.root.join("spec", "fixtures", "sample_esp_counts.csv")
end
end