fix: correctly load survey items from sample framework file. Fix broken tests

This commit is contained in:
Nelson Jovel 2024-08-27 12:45:52 -07:00
parent 2b2d89a26a
commit e989afd90c
9 changed files with 350 additions and 241 deletions

View file

@ -1,11 +1,11 @@
module Report
class Subcategory
def self.create_report(schools: School.all.includes(:district), academic_years: AcademicYear.all, subcategories: ::Subcategory.all, filename: "subcategories.csv")
data = to_csv(schools:, academic_years:, subcategories:, filename:)
csv = to_csv(schools:, academic_years:, subcategories:, filename:)
FileUtils.mkdir_p Rails.root.join("tmp", "reports")
filepath = Rails.root.join("tmp", "reports", filename)
write_csv(data:, filepath:)
data
write_csv(csv:, filepath:)
csv
end
def self.to_csv(schools: School.all.includes(:district), academic_years: AcademicYear.all, subcategories: ::Subcategory.all, filename: "subcategories.csv")
@ -74,7 +74,7 @@ module Report
end
end
def self.write_csv(data:, filepath:)
def self.write_csv(csv:, filepath:)
File.write(filepath, csv)
end

View file

@ -6,7 +6,8 @@ class Score < ApplicationRecord
belongs_to :academic_year
belongs_to :race
NIL_SCORE = Score.new(average: nil, meets_teacher_threshold: false, meets_student_threshold: false, meets_admin_data_threshold: false)
NIL_SCORE = Score.new(average: nil, meets_teacher_threshold: false, meets_student_threshold: false,
meets_admin_data_threshold: false)
enum group: {
all_students: 0,