fix: correctly reference SurveyItemResponse in Subcategory report

This commit is contained in:
Nelson Jovel 2024-07-19 13:13:16 -07:00
parent ffb989d8fd
commit f2e576a978

View file

@ -23,9 +23,9 @@ 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:, begin_date = ::SurveyItemResponse.where(school:,
academic_year:).where.not(recorded_date: nil).order(:recorded_date).first&.recorded_date&.to_date academic_year:).where.not(recorded_date: nil).order(:recorded_date).first&.recorded_date&.to_date
end_date = SurveyItemResponse.where(school:, end_date = ::SurveyItemResponse.where(school:,
academic_year:).where.not(recorded_date: nil).order(:recorded_date).last&.recorded_date&.to_date academic_year:).where.not(recorded_date: nil).order(:recorded_date).last&.recorded_date&.to_date
date_range = "#{begin_date} - #{end_date}" date_range = "#{begin_date} - #{end_date}"