mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-07 21:48:16 -08:00
Create ui for data filters. Add listeners to direct to the correct url. Update ui based on the list of selected params
This commit is contained in:
parent
4f0b92fa79
commit
765ad6a624
35 changed files with 14776 additions and 2878 deletions
|
|
@ -2,18 +2,23 @@
|
|||
|
||||
class AcademicYear < ActiveRecord::Base
|
||||
def self.find_by_date(date)
|
||||
if date.month > 6
|
||||
ay_range_start = date.year
|
||||
ay_range_end = date.year + 1
|
||||
else
|
||||
ay_range_start = date.year - 1
|
||||
ay_range_end = date.year
|
||||
end
|
||||
AcademicYear.find_by_range("#{ay_range_start}-#{ay_range_end.to_s[2, 3]}")
|
||||
year = parse_year_range(date:)
|
||||
AcademicYear.find_by_range("#{year.start}-#{year.end.to_s[2, 3]}")
|
||||
end
|
||||
|
||||
def formatted_range
|
||||
years = range.split('-')
|
||||
"#{years.first} – 20#{years.second}"
|
||||
end
|
||||
|
||||
def self.parse_year_range(date:)
|
||||
year = date.year
|
||||
if date.month > 6
|
||||
AcademicYearRange.new(year, year + 1)
|
||||
else
|
||||
AcademicYearRange.new(year - 1, year)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
AcademicYearRange = Struct.new(:start, :end)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue