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
|
1
|
||||||
end
|
end
|
||||||
|
|
||||||
def java_course_token
|
experimental_courses = {
|
||||||
"702cbd2a-c84c-4b37-923a-692d7d1532d0"
|
"java17" => "702cbd2a-c84c-4b37-923a-692d7d1532d0",
|
||||||
|
"java1" => "0ea88ea9-979a-44a3-b0e4-84ba58e5a05e"
|
||||||
|
}
|
||||||
|
|
||||||
|
def experimental_course?(course_token)
|
||||||
|
experimental_courses.has_value?(course_token)
|
||||||
end
|
end
|
||||||
|
|
||||||
def batch_update
|
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
|
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_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
|
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)
|
user_intervention_group = UserGroupSeparator.getInterventionGroup(current_user)
|
||||||
|
@rfc_group = UserGroupSeparator.getRequestforCommentGroup(current_user)
|
||||||
|
|
||||||
case user_intervention_group
|
case user_intervention_group
|
||||||
when :no_intervention
|
when :no_intervention
|
||||||
when :break_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
|
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
|
end
|
||||||
|
|
||||||
@search = Search.new
|
@search = Search.new
|
||||||
@ -396,6 +409,11 @@ class ExercisesController < ApplicationController
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if @is_experimental_course and @rfc_group == :hide_rfc
|
||||||
|
redirect_to_lti_return_path
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
rfc = @submission.own_unsolved_rfc
|
rfc = @submission.own_unsolved_rfc
|
||||||
if rfc
|
if rfc
|
||||||
# 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.
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
- consumer_id = @current_user.respond_to?(:external_id) ? @current_user.consumer_id : '' #'tests' #(@current_user.uuid.present? ? @current_user.uuid : '')
|
- consumer_id = @current_user.respond_to?(:external_id) ? @current_user.consumer_id : '' #'tests' #(@current_user.uuid.present? ? @current_user.uuid : '')
|
||||||
- show_break_interventions = @show_break_interventions || "false"
|
- show_break_interventions = @show_break_interventions || "false"
|
||||||
- show_rfc_interventions = @show_rfc_interventions || "false"
|
- show_rfc_interventions = @show_rfc_interventions || "false"
|
||||||
|
- hide_rfc_button = @hide_rfc_button || "false"
|
||||||
#editor.row data-exercise-id=@exercise.id data-message-depleted=t('exercises.editor.depleted') data-message-timeout=t('exercises.editor.timeout', permitted_execution_time: @exercise.execution_environment.permitted_execution_time) data-errors-url=execution_environment_errors_path(exercise.execution_environment) data-submissions-url=submissions_path data-user-id=@current_user.id data-user-external-id=external_user_external_id data-working-times-url=working_times_exercise_path(@exercise) data-intervention-save-url=intervention_exercise_path(@exercise) data-rfc-interventions=show_rfc_interventions data-break-interventions=show_break_interventions data-course_token=@course_token data-search-save-url=search_exercise_path(@exercise)
|
#editor.row data-exercise-id=@exercise.id data-message-depleted=t('exercises.editor.depleted') data-message-timeout=t('exercises.editor.timeout', permitted_execution_time: @exercise.execution_environment.permitted_execution_time) data-errors-url=execution_environment_errors_path(exercise.execution_environment) data-submissions-url=submissions_path data-user-id=@current_user.id data-user-external-id=external_user_external_id data-working-times-url=working_times_exercise_path(@exercise) data-intervention-save-url=intervention_exercise_path(@exercise) data-rfc-interventions=show_rfc_interventions data-break-interventions=show_break_interventions data-course_token=@course_token data-search-save-url=search_exercise_path(@exercise)
|
||||||
div id="sidebar" class=(@exercise.hide_file_tree ? 'sidebar-col-collapsed' : 'sidebar-col') = render('editor_file_tree', exercise: @exercise, files: @files)
|
div id="sidebar" class=(@exercise.hide_file_tree ? 'sidebar-col-collapsed' : 'sidebar-col') = render('editor_file_tree', exercise: @exercise, files: @files)
|
||||||
div id='output_sidebar' class='output-col-collapsed' = render('exercises/editor_output', external_user_id: external_user_id, consumer_id: consumer_id )
|
div id='output_sidebar' class='output-col-collapsed' = render('exercises/editor_output', external_user_id: external_user_id, consumer_id: consumer_id )
|
||||||
@ -14,7 +15,8 @@
|
|||||||
= render('editor_button', data: {:'data-placement' => 'top', :'data-tooltip' => true}, icon: 'fa fa-stop', id: 'stop', label: t('exercises.editor.stop'), title: t('shared.tooltips.shortcut', shortcut: 'ALT + r'))
|
= render('editor_button', data: {:'data-placement' => 'top', :'data-tooltip' => true}, icon: 'fa fa-stop', id: 'stop', label: t('exercises.editor.stop'), title: t('shared.tooltips.shortcut', shortcut: 'ALT + r'))
|
||||||
= render('editor_button', data: {:'data-placement' => 'top', :'data-tooltip' => true}, icon: 'fa fa-rocket', id: 'test', label: t('exercises.editor.test'), title: t('shared.tooltips.shortcut', shortcut: 'ALT + t'))
|
= render('editor_button', data: {:'data-placement' => 'top', :'data-tooltip' => true}, icon: 'fa fa-rocket', id: 'test', label: t('exercises.editor.test'), title: t('shared.tooltips.shortcut', shortcut: 'ALT + t'))
|
||||||
= render('editor_button', data: {:'data-placement' => 'top', :'data-tooltip' => true}, icon: 'fa fa-trophy', id: 'assess', label: t('exercises.editor.score'), title: t('shared.tooltips.shortcut', shortcut: 'ALT + s'))
|
= render('editor_button', data: {:'data-placement' => 'top', :'data-tooltip' => true}, icon: 'fa fa-trophy', id: 'assess', label: t('exercises.editor.score'), title: t('shared.tooltips.shortcut', shortcut: 'ALT + s'))
|
||||||
= render('editor_button', icon: 'fa fa-comment', id: 'requestComments', label: t('exercises.editor.requestComments'), title: t('exercises.editor.requestCommentsTooltip'))
|
- if not hide_rfc_button
|
||||||
|
= render('editor_button', icon: 'fa fa-comment', id: 'requestComments', label: t('exercises.editor.requestComments'), title: t('exercises.editor.requestCommentsTooltip'))
|
||||||
- @files.each do |file|
|
- @files.each do |file|
|
||||||
= render('editor_frame', exercise: exercise, file: file)
|
= render('editor_frame', exercise: exercise, file: file)
|
||||||
#autosave-label
|
#autosave-label
|
||||||
|
@ -24,4 +24,15 @@ class UserGroupSeparator
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.getRequestforCommentGroup(user)
|
||||||
|
lastDigitId = user.id % 10
|
||||||
|
if lastDigitId < 2 # 0,1
|
||||||
|
:hide_rfc
|
||||||
|
elsif lastDigitId < 4 # 2,3
|
||||||
|
:stale_rfc
|
||||||
|
else # 4,5,6,7,8,9
|
||||||
|
:show_rfc
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
Reference in New Issue
Block a user