From 3d238df1c70f3bfa0b898992d048fe53a310fa75 Mon Sep 17 00:00:00 2001 From: Jared Cosulich Date: Sat, 21 Jul 2018 11:42:16 -0400 Subject: [PATCH] show accurate year --- app/controllers/categories_controller.rb | 3 ++- app/views/layouts/_school_header.html.haml | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/controllers/categories_controller.rb b/app/controllers/categories_controller.rb index 8405f751..3ac50346 100644 --- a/app/controllers/categories_controller.rb +++ b/app/controllers/categories_controller.rb @@ -13,7 +13,8 @@ class CategoriesController < ApplicationController def show district = @school.district authenticate(district.name.downcase, "#{district.name.downcase}!") - @school_category = SchoolCategory.for(@school, @category).first + @year = (params[:year] || "2017").to_i + @school_category = SchoolCategory.for(@school, @category).in(@year).first @child_school_categories = SchoolCategory.for_parent_category(@school, @category).valid @questions = @category.questions end diff --git a/app/views/layouts/_school_header.html.haml b/app/views/layouts/_school_header.html.haml index c896d4f8..d7307538 100644 --- a/app/views/layouts/_school_header.html.haml +++ b/app/views/layouts/_school_header.html.haml @@ -3,7 +3,11 @@ =# link_to(image_tag(@district.logo), @district) if @district.present? %h2= link_to @school.name, @school = simple_format(@school.description) - %p Data from 2016-2017 school year. + - if @year.present? + %p + Data from + = "#{@year - 1}-#{@year}" + school year. - if @school.district.present? %p %strong District: