From 094aba096c5063187d24ed3fe1458a04f7d51c8b Mon Sep 17 00:00:00 2001 From: Sebastian Serth Date: Wed, 30 Aug 2023 18:14:59 +0200 Subject: [PATCH] Fix feedback page by accessing the contributor Fixes CODEOCEAN-TE --- app/models/user_exercise_feedback.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/models/user_exercise_feedback.rb b/app/models/user_exercise_feedback.rb index 4122118d..6889b7dc 100644 --- a/app/models/user_exercise_feedback.rb +++ b/app/models/user_exercise_feedback.rb @@ -17,7 +17,9 @@ class UserExerciseFeedback < ApplicationRecord end def anomaly_notification - AnomalyNotification.where({exercise_id: exercise.id, user:}) - .where('created_at < ?', created_at).order('created_at DESC').to_a.first + AnomalyNotification + .where(exercise:, contributor: user, created_at: ...created_at) + .order(created_at: :desc) + .first end end