diff --git a/app/models/user_exercise_feedback.rb b/app/models/user_exercise_feedback.rb index 5694573b..3075b96e 100644 --- a/app/models/user_exercise_feedback.rb +++ b/app/models/user_exercise_feedback.rb @@ -9,4 +9,9 @@ class UserExerciseFeedback < ActiveRecord::Base def to_s "User Exercise Feedback" end + + def anomaly_notification + AnomalyNotification.where({exercise_id: exercise.id, user_id: user_id, user_type: user_type}) + .where("created_at < ?", created_at).order("created_at DESC").to_a.first + end end