- added abc group separator class to split users into different groups for testing proxy exercises and interventions
- shows 2 interventions per user and exercise max now - only show break or rfc intervention to user
This commit is contained in:
@ -578,64 +578,63 @@ configureEditors: function () {
|
|||||||
* interventions
|
* interventions
|
||||||
* */
|
* */
|
||||||
initializeInterventionTimer: function() {
|
initializeInterventionTimer: function() {
|
||||||
$.ajax({
|
if ($('#editor').data('rfc-interventions') == true || $('#editor').data('break-interventions') == true) { // split in break or rfc intervention
|
||||||
data: {
|
$.ajax({
|
||||||
exercise_id: $('#editor').data('exercise-id'),
|
data: {
|
||||||
user_id: $('#editor').data('user-id')
|
exercise_id: $('#editor').data('exercise-id'),
|
||||||
},
|
user_id: $('#editor').data('user-id')
|
||||||
dataType: 'json',
|
},
|
||||||
method: 'GET',
|
dataType: 'json',
|
||||||
// get working times for this exercise
|
method: 'GET',
|
||||||
url: $('#editor').data('working-times-url'),
|
// get working times for this exercise
|
||||||
success: function (data) {
|
url: $('#editor').data('working-times-url'),
|
||||||
var percentile75 = data['working_time_75_percentile'];
|
success: function (data) {
|
||||||
var accumulatedWorkTimeUser = data['working_time_accumulated'];
|
var percentile75 = data['working_time_75_percentile'];
|
||||||
|
var accumulatedWorkTimeUser = data['working_time_accumulated'];
|
||||||
|
|
||||||
var timeUntilBreak = 20 * 60 * 1000;
|
var minTimeIntervention = 10 * 60 * 1000;
|
||||||
var minTimeUntilAskQuestion = 15 * 60 * 1000;
|
|
||||||
|
|
||||||
if ((accumulatedWorkTimeUser - percentile75) > 0) {
|
if ((accumulatedWorkTimeUser - percentile75) > 0) {
|
||||||
// working time is already over 75 percentile
|
// working time is already over 75 percentile
|
||||||
var timeUntilAskQuestion = minTimeUntilAskQuestion;
|
var timeUntilIntervention = minTimeIntervention;
|
||||||
} else {
|
} else {
|
||||||
// working time is less than 75 percentile
|
// working time is less than 75 percentile
|
||||||
// ensure we give user at least 10 minutes before we bother the user
|
// ensure we give user at least minTimeIntervention before we bother the user
|
||||||
var timeUntilAskForRFC = (percentile75 - accumulatedWorkTimeUser) > minTimeUntilAskQuestion ? (percentile75 - accumulatedWorkTimeUser) : minTimeUntilAskQuestion;
|
var timeUntilIntervention = Math.max(percentile75 - accumulatedWorkTimeUser, minTimeIntervention);
|
||||||
|
}
|
||||||
|
if ($('#editor').data('break-interventions')){
|
||||||
|
setTimeout(function () {
|
||||||
|
$('#break-intervention-modal').modal('show');
|
||||||
|
$.ajax({
|
||||||
|
data: {
|
||||||
|
intervention_type: 'BreakIntervention'
|
||||||
|
},
|
||||||
|
dataType: 'json',
|
||||||
|
type: 'POST',
|
||||||
|
url: $('#editor').data('intervention-save-url')
|
||||||
|
});
|
||||||
|
}, 0);
|
||||||
|
} else if ($('#editor').data('rfc-interventions')) {
|
||||||
|
setTimeout(function () {
|
||||||
|
var button = $('#requestComments');
|
||||||
|
// only show intervention if user did not requested for a comment already
|
||||||
|
if (!button.prop('disabled')) {
|
||||||
|
$('#rfc_intervention_text').show();
|
||||||
|
$('#comment-modal').modal('show');
|
||||||
|
$.ajax({
|
||||||
|
data: {
|
||||||
|
intervention_type: 'QuestionIntervention'
|
||||||
|
},
|
||||||
|
dataType: 'json',
|
||||||
|
type: 'POST',
|
||||||
|
url: $('#editor').data('intervention-save-url')
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
});
|
||||||
// if notifications are too close to each other, ensure some time differences between them
|
}
|
||||||
if (Math.abs(timeUntilAskForRFC - timeUntilBreak) < 5 * 1000 * 60){
|
|
||||||
timeUntilBreak = timeUntilBreak * 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
setTimeout(function() {
|
|
||||||
$('#break-intervention-modal').modal('show');
|
|
||||||
$.ajax({
|
|
||||||
data: {
|
|
||||||
intervention_type: 'BreakIntervention'
|
|
||||||
},
|
|
||||||
dataType: 'json',
|
|
||||||
type: 'POST',
|
|
||||||
url: $('#editor').data('intervention-save-url')});
|
|
||||||
}, timeUntilBreak);
|
|
||||||
|
|
||||||
|
|
||||||
setTimeout(function() {
|
|
||||||
var button = $('#requestComments');
|
|
||||||
if (!button.prop('disabled')){
|
|
||||||
$('#rfc_intervention_text').show();
|
|
||||||
$('#comment-modal').modal('show');
|
|
||||||
$.ajax({
|
|
||||||
data: {
|
|
||||||
intervention_type: 'QuestionIntervention'
|
|
||||||
},
|
|
||||||
dataType: 'json',
|
|
||||||
type: 'POST',
|
|
||||||
url: $('#editor').data('intervention-save-url')});
|
|
||||||
};
|
|
||||||
}, timeUntilAskForRFC);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
initializeSearchButton: function(){
|
initializeSearchButton: function(){
|
||||||
@ -671,9 +670,7 @@ configureEditors: function () {
|
|||||||
this.initializeDescriptionToggle();
|
this.initializeDescriptionToggle();
|
||||||
this.initializeSideBarTooltips();
|
this.initializeSideBarTooltips();
|
||||||
this.initializeTooltips();
|
this.initializeTooltips();
|
||||||
if ($('#editor').data('show-interventions') == true){
|
this.initializeInterventionTimer();
|
||||||
this.initializeInterventionTimer();
|
|
||||||
}
|
|
||||||
this.initializeSearchButton();
|
this.initializeSearchButton();
|
||||||
this.initPrompt();
|
this.initPrompt();
|
||||||
this.renderScore();
|
this.renderScore();
|
||||||
|
@ -21,7 +21,7 @@ class ExercisesController < ApplicationController
|
|||||||
private :authorize!
|
private :authorize!
|
||||||
|
|
||||||
def max_intervention_count
|
def max_intervention_count
|
||||||
3
|
2
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -168,7 +168,18 @@ class ExercisesController < ApplicationController
|
|||||||
user_got_enough_interventions = UserExerciseIntervention.where(exercise: @exercise, user: current_user).count >= max_intervention_count
|
user_got_enough_interventions = UserExerciseIntervention.where(exercise: @exercise, user: current_user).count >= max_intervention_count
|
||||||
is_java_course = @course_token && @course_token.eql?(java_course_token)
|
is_java_course = @course_token && @course_token.eql?(java_course_token)
|
||||||
|
|
||||||
@show_interventions = (!is_java_course || user_got_enough_interventions) ? "false" : "true"
|
user_intervention_group = UserGroupSeparator.getInterventionGroup(current_user)
|
||||||
|
|
||||||
|
case user_intervention_group
|
||||||
|
when :no_intervention
|
||||||
|
puts "non"
|
||||||
|
when :break_intervention
|
||||||
|
puts "break"
|
||||||
|
@show_break_interventions = (!is_java_course || user_got_enough_interventions) ? "false" : "true"
|
||||||
|
when :rfc_intervention
|
||||||
|
puts "rfc"
|
||||||
|
@show_rfc_interventions = (!is_java_course || user_got_enough_interventions) ? "false" : "true"
|
||||||
|
end
|
||||||
|
|
||||||
@search = Search.new
|
@search = Search.new
|
||||||
@search.exercise = @exercise
|
@search.exercise = @exercise
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
- external_user_external_id = @current_user.respond_to?(:external_id) ? @current_user.external_id : '' #'tests' #(@current_user.uuid.present? ? @current_user.uuid : '')
|
- external_user_external_id = @current_user.respond_to?(:external_id) ? @current_user.external_id : '' #'tests' #(@current_user.uuid.present? ? @current_user.uuid : '')
|
||||||
- external_user_id = @current_user.respond_to?(:external_id) ? @current_user.id : '' #'tests' #(@current_user.uuid.present? ? @current_user.uuid : '')
|
- external_user_id = @current_user.respond_to?(:external_id) ? @current_user.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 : '')
|
- consumer_id = @current_user.respond_to?(:external_id) ? @current_user.consumer_id : '' #'tests' #(@current_user.uuid.present? ? @current_user.uuid : '')
|
||||||
- show_interventions = @show_interventions || "false"
|
- show_break_interventions = @show_break_interventions || "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 data-intervention-save-url=intervention_exercise_path data-show-interventions=show_interventions data-course_token=@course_token data-search-save-url=search_exercise_path
|
- show_rfc_interventions = @show_rfc_interventions || "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 data-intervention-save-url=intervention_exercise_path data-rfc-interventions=show_rfc_interventions data-break-interventions=show_break_interventions data-course_token=@course_token data-search-save-url=search_exercise_path
|
||||||
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 )
|
||||||
div id='frames' class='editor-col'
|
div id='frames' class='editor-col'
|
||||||
|
27
lib/user_group_separator.rb
Normal file
27
lib/user_group_separator.rb
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
class UserGroupSeparator
|
||||||
|
|
||||||
|
# seperates user into 30% no intervention, 30% break intervention, 40% rfc intervention
|
||||||
|
def self.getInterventionGroup(user)
|
||||||
|
lastDigitId = user.id % 10
|
||||||
|
if lastDigitId < 3 # 0,1,2
|
||||||
|
:no_intervention
|
||||||
|
elsif lastDigitId < 6 # 3,4,5
|
||||||
|
:break_intervention
|
||||||
|
else # 6,7,8,9
|
||||||
|
:rfc_intervention
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# seperates user into 20% dummy assignment, 20% random assignemnt, 60% recommended assignment
|
||||||
|
def self.getProxyExerciseGroup(user)
|
||||||
|
lastDigitCreatedAt = user.created_at.to_i % 10
|
||||||
|
if lastDigitCreatedAt < 2 # 0,1
|
||||||
|
:dummy_assigment
|
||||||
|
elsif lastDigitCreatedAt < 4 # 2,3
|
||||||
|
:random_assigment
|
||||||
|
else # 4,5,6,7,8,9
|
||||||
|
:recommended_assignment
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
Reference in New Issue
Block a user