don't redirect to rfc for experimental groups and hide the button for them
This commit is contained in:
@ -28,8 +28,13 @@ class ExercisesController < ApplicationController
|
||||
1
|
||||
end
|
||||
|
||||
def java_course_token
|
||||
"702cbd2a-c84c-4b37-923a-692d7d1532d0"
|
||||
experimental_courses = {
|
||||
"java17" => "702cbd2a-c84c-4b37-923a-692d7d1532d0",
|
||||
"java1" => "0ea88ea9-979a-44a3-b0e4-84ba58e5a05e"
|
||||
}
|
||||
|
||||
def experimental_course?(course_token)
|
||||
experimental_courses.has_value?(course_token)
|
||||
end
|
||||
|
||||
def batch_update
|
||||
@ -176,16 +181,24 @@ class ExercisesController < ApplicationController
|
||||
count_interventions_today = UserExerciseIntervention.where(user: current_user).where("created_at >= ?", Time.zone.now.beginning_of_day).count
|
||||
user_got_intervention_in_exercise = UserExerciseIntervention.where(user: current_user, exercise: @exercise).size >= max_intervention_count_per_exercise
|
||||
user_got_enough_interventions = count_interventions_today >= max_intervention_count_per_day or user_got_intervention_in_exercise
|
||||
is_java_course = @course_token and @course_token.eql?(java_course_token)
|
||||
@is_experimental_course = @course_token and experimental_course?(@course_token)
|
||||
|
||||
user_intervention_group = UserGroupSeparator.getInterventionGroup(current_user)
|
||||
@rfc_group = UserGroupSeparator.getRequestforCommentGroup(current_user)
|
||||
|
||||
case user_intervention_group
|
||||
when :no_intervention
|
||||
when :break_intervention
|
||||
@show_break_interventions = (not user_solved_exercise and is_java_course and not user_got_enough_interventions) ? "true" : "false"
|
||||
@show_break_interventions = (is_experimental_course and not user_solved_exercise and not user_got_enough_interventions) ? "true" : "false"
|
||||
when :rfc_intervention
|
||||
@show_rfc_interventions = (not user_solved_exercise and is_java_course and not user_got_enough_interventions) ? "true" : "false"
|
||||
@show_rfc_interventions = (is_experimental_course and not user_solved_exercise and not user_got_enough_interventions) ? "true" : "false"
|
||||
end
|
||||
|
||||
case rfc_group
|
||||
when :hide_rfc
|
||||
@hide_rfc_button = "true"
|
||||
when :stale_rfc
|
||||
when :show_rfc
|
||||
end
|
||||
|
||||
@search = Search.new
|
||||
@ -396,6 +409,11 @@ class ExercisesController < ApplicationController
|
||||
return
|
||||
end
|
||||
|
||||
if @is_experimental_course and @rfc_group == :hide_rfc
|
||||
redirect_to_lti_return_path
|
||||
return
|
||||
end
|
||||
|
||||
rfc = @submission.own_unsolved_rfc
|
||||
if rfc
|
||||
# set a message that informs the user that his own RFC should be closed.
|
||||
|
Reference in New Issue
Block a user