mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-09 07:28:41 -07:00
fix: correctly load survey items from sample framework file. Fix broken tests
This commit is contained in:
parent
07836cc020
commit
f689ee8ee5
7 changed files with 414 additions and 305 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue