mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-07 21:48:16 -08: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]
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@
|
|||
# rails c -> SchoolCategory.update_all(year: '2017')
|
||||
# rake data:load_questions_csv; rake data:load_responses
|
||||
|
||||
# sudo heroku run rake db:migrate -a mciea-beta
|
||||
# sudo heroku run console -a mciea-beta
|
||||
# sudo heroku run rake data:load_questions_csv -a mciea-beta
|
||||
# sudo heroku run:detached rake data:load_responses -a mciea-beta --size performance-l
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue