Merge pull request #224 from openHPI/rt/fix_uef

Fix retrieval of user_exercise_feedback and exercise
This commit is contained in:
rteusner
2018-11-15 17:29:34 +01:00
committed by GitHub

View File

@ -1,8 +1,7 @@
class UserExerciseFeedbacksController < ApplicationController
include CommonBehavior
before_action :set_user_exercise_feedback, only: [:edit, :update]
before_action :set_user_exercise_feedback_by_id, only: [:show, :destroy]
before_action :set_user_exercise_feedback, only: [:edit, :update, :show, :destroy]
def comment_presets
[[0,t('user_exercise_feedback.difficulty_easy')],
@ -103,12 +102,8 @@ class UserExerciseFeedbacksController < ApplicationController
end
def set_user_exercise_feedback
@exercise = Exercise.find(params[:user_exercise_feedback][:exercise_id])
@uef = UserExerciseFeedback.find_by(exercise_id: params[:user_exercise_feedback][:exercise_id], user: current_user)
end
def set_user_exercise_feedback_by_id
@uef = UserExerciseFeedback.find(params[:id])
@exercise = @uef.exercise
end
def uef_params