mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-13 09:20:38 -07:00
filter questions by year
This commit is contained in:
parent
fd6ec3af2a
commit
eba821556b
3 changed files with 4 additions and 1 deletions
|
|
@ -19,7 +19,7 @@ class CategoriesController < ApplicationController
|
|||
@years.delete(@year)
|
||||
@school_category = school_categories.in(@year).first
|
||||
@child_school_categories = SchoolCategory.for_parent_category(@school, @category).in(@year).valid
|
||||
@questions = @category.questions
|
||||
@questions = @category.questions.created_in(@year)
|
||||
end
|
||||
|
||||
# GET /categories/new
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ class Question < ApplicationRecord
|
|||
validates :option5, presence: true
|
||||
|
||||
scope :for_category, -> (category) { where(category: category) }
|
||||
scope :created_in, -> (year) { where('extract(year from questions.created_at) = ?', year) }
|
||||
|
||||
enum target_group: [:unknown, :for_students, :for_teachers, :for_parents]
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue