From e5bf7d1527491af4663c203ec17697e8855b650f Mon Sep 17 00:00:00 2001 From: Marius Peter Date: Wed, 1 Jan 2025 17:49:39 +0100 Subject: Cleaned up scores controller and tartiflette scoring service. --- app/models/score.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'app/models/score.rb') diff --git a/app/models/score.rb b/app/models/score.rb index 5147ce0..ccc795f 100644 --- a/app/models/score.rb +++ b/app/models/score.rb @@ -3,4 +3,9 @@ class Score < ApplicationRecord belongs_to :scoring_criterium validates :value, presence: true, inclusion: { in: 1..5 } + validates :session_id, presence: true + validates :tartiflette_id, uniqueness: { + scope: [:scoring_criterium_id, :session_id], + message: "has already been scored for this session and criterium." + } end -- cgit v1.2.3