From 3093d9236ac80ff519346f2501ad6a07c90dc49b Mon Sep 17 00:00:00 2001 From: Nelson Jovel Date: Fri, 5 Jan 2024 09:17:01 -0800 Subject: [PATCH] chore: ensure likert score ranges from 1 to 5 --- app/models/dashboard/survey_item_response.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/models/dashboard/survey_item_response.rb b/app/models/dashboard/survey_item_response.rb index e4771c5..1ecec75 100644 --- a/app/models/dashboard/survey_item_response.rb +++ b/app/models/dashboard/survey_item_response.rb @@ -14,6 +14,8 @@ module Dashboard has_one :dashboard_measure, through: :dashboard_survey_item + validates :likert_score, numericality: { greater_than: 0, less_than_or_equal_to: 5 } + scope :exclude_boston, lambda { includes(school: :district).where.not("district.name": "Boston") }