Distinguish between intermediate and final feedback

* Also add more information to user_exercise_feedback
* Migrate existing feedback to enrich with submissions
This commit is contained in:
Sebastian Serth
2020-10-20 13:50:04 +02:00
parent 712810dada
commit ad467fa58f
7 changed files with 63 additions and 9 deletions

View File

@ -2,10 +2,14 @@ class UserExerciseFeedback < ApplicationRecord
include Creation
belongs_to :exercise
belongs_to :submission, optional: true
has_one :execution_environment, through: :exercise
validates :user_id, uniqueness: { scope: [:exercise_id, :user_type] }
scope :intermediate, -> { where.not(normalized_score: 1.00) }
scope :final, -> { where(normalized_score: 1.00) }
def to_s
"User Exercise Feedback"
end