mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-07 21:48:16 -08:00
Detect the latest year for which a school has data and select that year
when routing from welcome page.
This commit is contained in:
parent
a1689a3550
commit
5a9e8b3586
2 changed files with 6 additions and 5 deletions
|
|
@ -55,6 +55,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- Precalculate response rates
|
||||
- Add page caching
|
||||
- Add counter caches
|
||||
- Detect the latest year for which a school has data and direct a user to that year when routing from welcome page
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
|
|
|
|||
|
|
@ -42,11 +42,11 @@ module HeaderHelper
|
|||
end
|
||||
|
||||
def latest_year(school)
|
||||
if school.district.name == 'Attleboro' || school.district.name == 'Winchester'
|
||||
AcademicYear.find_by_range('2021-22')
|
||||
else
|
||||
AcademicYear.find_by_range('2020-21')
|
||||
end
|
||||
latest_response_rate = ResponseRate.where(school:).where('meets_student_threshold = ? or meets_teacher_threshold = ?', true,
|
||||
true).joins('inner join academic_years a on response_rates.academic_year_id=a.id').order('a.range DESC').first
|
||||
academic_year = latest_response_rate.academic_year if latest_response_rate.present?
|
||||
|
||||
academic_year ||= AcademicYear.order('range DESC').first
|
||||
end
|
||||
|
||||
def link_weight(path:)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue