mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-07 21:48:16 -08:00
Add date range to subcategory report export
This commit is contained in:
parent
e8aa75bf66
commit
703928c234
1 changed files with 8 additions and 1 deletions
|
|
@ -3,7 +3,7 @@ module Report
|
||||||
def self.create_report(schools: School.all.includes(:district), academic_years: AcademicYear.all, subcategories: ::Subcategory.all, filename: 'subcategories.csv')
|
def self.create_report(schools: School.all.includes(:district), academic_years: AcademicYear.all, subcategories: ::Subcategory.all, filename: 'subcategories.csv')
|
||||||
data = []
|
data = []
|
||||||
mutex = Thread::Mutex.new
|
mutex = Thread::Mutex.new
|
||||||
data << ['District', 'School', 'School Code', 'Academic Year', 'Grades', 'Subcategory', 'Student Score', 'Student Zone', 'Teacher Score',
|
data << ['District', 'School', 'School Code', 'Academic Year', 'Recorded Date Range', 'Grades', 'Subcategory', 'Student Score', 'Student Zone', 'Teacher Score',
|
||||||
'Teacher Zone', 'Admin Score', 'Admin Zone', 'All Score (Average)', 'All Score Zone']
|
'Teacher Zone', 'Admin Score', 'Admin Zone', 'All Score (Average)', 'All Score Zone']
|
||||||
pool_size = 2
|
pool_size = 2
|
||||||
jobs = Queue.new
|
jobs = Queue.new
|
||||||
|
|
@ -23,6 +23,12 @@ module Report
|
||||||
score = subcategory.score(school:, academic_year:)
|
score = subcategory.score(school:, academic_year:)
|
||||||
zone = subcategory.zone(school:, academic_year:).type.to_s.capitalize
|
zone = subcategory.zone(school:, academic_year:).type.to_s.capitalize
|
||||||
|
|
||||||
|
begin_date = SurveyItemResponse.where(school:,
|
||||||
|
academic_year:).where.not(recorded_date: nil).order(:recorded_date).first&.recorded_date&.to_date
|
||||||
|
end_date = SurveyItemResponse.where(school:,
|
||||||
|
academic_year:).where.not(recorded_date: nil).order(:recorded_date).last&.recorded_date&.to_date
|
||||||
|
date_range = "#{begin_date} - #{end_date}"
|
||||||
|
|
||||||
row = [response_rate, subcategory, school, academic_year]
|
row = [response_rate, subcategory, school, academic_year]
|
||||||
|
|
||||||
all_grades = respondents.counts_by_grade.keys
|
all_grades = respondents.counts_by_grade.keys
|
||||||
|
|
@ -32,6 +38,7 @@ module Report
|
||||||
school.name,
|
school.name,
|
||||||
school.dese_id,
|
school.dese_id,
|
||||||
academic_year.range,
|
academic_year.range,
|
||||||
|
date_range,
|
||||||
grades,
|
grades,
|
||||||
subcategory.subcategory_id,
|
subcategory.subcategory_id,
|
||||||
student_score(row:),
|
student_score(row:),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue