mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-07 13:38:18 -08:00
ECP-215 prep for item level exports
This commit is contained in:
parent
4561d34d02
commit
1310fd9f1c
2 changed files with 11 additions and 8 deletions
|
|
@ -1,10 +1,10 @@
|
||||||
module Report
|
module Report
|
||||||
class Exports
|
class Exports
|
||||||
def self.create
|
def self.create(districts: ::District.all, academic_years: ::AcademicYear.all, use_student_survey_items: ::SurveyItem.student_survey_items.map(&:id))
|
||||||
academic_years = ::AcademicYear.all
|
# academic_years = ::AcademicYear.all
|
||||||
districts = ::District.all
|
# districts = ::District.all
|
||||||
use_student_survey_items = ::SurveyItem.student_survey_items.map(&:id)
|
# use_student_survey_items = ::SurveyItem.student_survey_items.map(&:id)
|
||||||
schools = ::School.all.includes(:district)
|
schools = districts.flat_map(&:schools)
|
||||||
|
|
||||||
reports = {
|
reports = {
|
||||||
"Subcategory by School & District" => lambda { |schools, academic_years|
|
"Subcategory by School & District" => lambda { |schools, academic_years|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
require "fileutils"
|
||||||
namespace :report do
|
namespace :report do
|
||||||
desc "create a report of the scores for all subcategories"
|
desc "create a report of the scores for all subcategories"
|
||||||
task subcategory: :environment do
|
task subcategory: :environment do
|
||||||
|
|
@ -202,11 +203,13 @@ namespace :report do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Usage example
|
|
||||||
# bundle exec rake "report:exports:create"
|
|
||||||
namespace :exports do
|
namespace :exports do
|
||||||
|
# Usage example
|
||||||
|
# bundle exec rake "report:exports:create"
|
||||||
task :create, %i[district academic_year] => :environment do |_, _args|
|
task :create, %i[district academic_year] => :environment do |_, _args|
|
||||||
Report::Exports.create
|
Report::Exports.create(districts: ::District.all, academic_years: ::AcademicYear.all, use_student_survey_items: ::SurveyItem.student_survey_items.map(&:id))
|
||||||
|
FileUtils.mkdir_p(Rails.root.join("tmp", "exports", "measure_by_grade"))
|
||||||
|
Report::MeasureByGrade.run(filepath: Rails.root.join("tmp", "exports", "measure_by_grade", "measure_by_grade.csv"))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue