redirect only external user to feedback page after submission
This commit is contained in:
@ -381,11 +381,11 @@ class ExercisesController < ApplicationController
|
|||||||
# if user is external and has an own rfc, redirect to it and message him to clean up and accept the answer. (we need to check that the user is external,
|
# if user is external and has an own rfc, redirect to it and message him to clean up and accept the answer. (we need to check that the user is external,
|
||||||
# otherwise an internal user could be shown a false rfc here, since current_user.id is polymorphic, but only makes sense for external users when used with rfcs.)
|
# otherwise an internal user could be shown a false rfc here, since current_user.id is polymorphic, but only makes sense for external users when used with rfcs.)
|
||||||
# redirect 10 percent pseudorandomly to the feedback page
|
# redirect 10 percent pseudorandomly to the feedback page
|
||||||
if ((current_user.id + @submission.exercise.created_at.to_i) % 10 == 1)
|
if current_user.respond_to? :external_id
|
||||||
redirect_to_user_feedback
|
if ((current_user.id + @submission.exercise.created_at.to_i) % 10 == 1)
|
||||||
return
|
redirect_to_user_feedback
|
||||||
elsif current_user.respond_to? :external_id
|
return
|
||||||
if rfc = RequestForComment.unsolved.where(exercise_id: @submission.exercise, user_id: current_user.id).first
|
elsif rfc = RequestForComment.unsolved.where(exercise_id: @submission.exercise, user_id: current_user.id).first
|
||||||
# set a message that informs the user that his own RFC should be closed.
|
# set a message that informs the user that his own RFC should be closed.
|
||||||
flash[:notice] = I18n.t('exercises.submit.full_score_redirect_to_own_rfc')
|
flash[:notice] = I18n.t('exercises.submit.full_score_redirect_to_own_rfc')
|
||||||
flash.keep(:notice)
|
flash.keep(:notice)
|
||||||
|
Reference in New Issue
Block a user