fixing years on school page

This commit is contained in:
Jared Cosulich 2018-07-21 13:06:18 -04:00
parent 2ddbb55a26
commit 9734b7dc06

View file

@ -11,7 +11,7 @@ class SchoolsController < ApplicationController
authenticate(district.name.downcase, "#{district.name.downcase}!")
@school_categories = @school.school_categories.for_parent_category(@school, nil).valid.sort
@years = @school_categories.map(&:year).map(&:to_i).sort
@years = @school_categories.map(&:year).map(&:to_i).sort.uniq
@year = (params[:year] || @years.first).to_i
@years.delete(@year)
@school_categories = @school_categories.select { |sc| sc.year.to_i == @year }