Feat: Add task to generate item-level survey report

This commit is contained in:
Gabe Farrell 2024-04-10 14:14:29 -04:00
parent 65d3733189
commit a085afb3b6
2 changed files with 118 additions and 0 deletions

View file

@ -70,4 +70,21 @@ namespace :report do
Report::BeyondLearningLoss.create_report(filename: "bll_report.csv", scales:)
end
end
namespace :survey_item do
task :by_item, [:school, :academic_year] => :environment do |_, args|
school = School.find_by_name(args[:school])
academic_year = AcademicYear.find_by_range(args[:academic_year])
if school == nil
puts "Invalid school name"
bad = 1
end
if academic_year == nil
puts "Invalid academic year"
bad = 1
end
next if bad == 1
Report::SurveyItem.create_report(school: , academic_year:, filename: "survey_item_by_item_report.csv")
end
end
end