Merge branch 'master' into save-run-results
This commit is contained in:
@ -323,9 +323,7 @@ configureEditors: function () {
|
|||||||
var button = $('#requestComments');
|
var button = $('#requestComments');
|
||||||
button.prop('disabled', true);
|
button.prop('disabled', true);
|
||||||
button.on('click', function () {
|
button.on('click', function () {
|
||||||
if ($('#editor').data('show-interventions') == true){
|
|
||||||
$('#rfc_intervention_text').hide()
|
$('#rfc_intervention_text').hide()
|
||||||
}
|
|
||||||
$('#comment-modal').modal('show');
|
$('#comment-modal').modal('show');
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -578,6 +576,7 @@ configureEditors: function () {
|
|||||||
* interventions
|
* interventions
|
||||||
* */
|
* */
|
||||||
initializeInterventionTimer: function() {
|
initializeInterventionTimer: function() {
|
||||||
|
if ($('#editor').data('rfc-interventions') == true || $('#editor').data('break-interventions') == true) { // split in break or rfc intervention
|
||||||
$.ajax({
|
$.ajax({
|
||||||
data: {
|
data: {
|
||||||
exercise_id: $('#editor').data('exercise-id'),
|
exercise_id: $('#editor').data('exercise-id'),
|
||||||
@ -591,23 +590,17 @@ configureEditors: function () {
|
|||||||
var percentile75 = data['working_time_75_percentile'];
|
var percentile75 = data['working_time_75_percentile'];
|
||||||
var accumulatedWorkTimeUser = data['working_time_accumulated'];
|
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')){
|
||||||
// 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 () {
|
setTimeout(function () {
|
||||||
$('#break-intervention-modal').modal('show');
|
$('#break-intervention-modal').modal('show');
|
||||||
$.ajax({
|
$.ajax({
|
||||||
@ -616,12 +609,13 @@ configureEditors: function () {
|
|||||||
},
|
},
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
url: $('#editor').data('intervention-save-url')});
|
url: $('#editor').data('intervention-save-url')
|
||||||
}, timeUntilBreak);
|
});
|
||||||
|
}, timeUntilIntervention);
|
||||||
|
} else if ($('#editor').data('rfc-interventions')) {
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
var button = $('#requestComments');
|
var button = $('#requestComments');
|
||||||
|
// only show intervention if user did not requested for a comment already
|
||||||
if (!button.prop('disabled')) {
|
if (!button.prop('disabled')) {
|
||||||
$('#rfc_intervention_text').show();
|
$('#rfc_intervention_text').show();
|
||||||
$('#comment-modal').modal('show');
|
$('#comment-modal').modal('show');
|
||||||
@ -631,11 +625,14 @@ configureEditors: function () {
|
|||||||
},
|
},
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
url: $('#editor').data('intervention-save-url')});
|
url: $('#editor').data('intervention-save-url')
|
||||||
|
});
|
||||||
};
|
};
|
||||||
}, timeUntilAskForRFC);
|
}, timeUntilIntervention);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
initializeSearchButton: function(){
|
initializeSearchButton: function(){
|
||||||
@ -671,9 +668,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();
|
||||||
@ -681,6 +676,6 @@ configureEditors: function () {
|
|||||||
|
|
||||||
$(window).on("beforeunload", this.unloadAutoSave.bind(this));
|
$(window).on("beforeunload", this.unloadAutoSave.bind(this));
|
||||||
// create autosave when the editor is opened the first time
|
// create autosave when the editor is opened the first time
|
||||||
this.autosave().bind(this);
|
this.autosave();
|
||||||
}
|
}
|
||||||
};
|
};
|
@ -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,15 @@ 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
|
||||||
|
when :break_intervention
|
||||||
|
@show_break_interventions = (!is_java_course || user_got_enough_interventions) ? "false" : "true"
|
||||||
|
when :rfc_intervention
|
||||||
|
@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
|
||||||
|
@ -53,7 +53,20 @@ class ProxyExercise < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
def find_matching_exercise(user)
|
def find_matching_exercise(user)
|
||||||
exercises_user_has_accessed = user.submissions.where("cause IN ('submit','assess')").map{|s| s.exercise}.uniq
|
user_group = UserGroupSeparator.getProxyExerciseGroup(user)
|
||||||
|
case user_group
|
||||||
|
when :dummy_assigment
|
||||||
|
rec_ex = select_easiest_exercise(exercises)
|
||||||
|
@reason[:reason] = "dummy group"
|
||||||
|
Rails.logger.debug("assigned user to dummy group, and gave him exercise: #{rec_ex.title}")
|
||||||
|
rec_ex
|
||||||
|
when :random_assigment
|
||||||
|
@reason[:reason] = "random group"
|
||||||
|
rec_ex = exercises.shuffle.first
|
||||||
|
Rails.logger.debug("assigned user to random group, and gave him exercise: #{rec_ex.title}")
|
||||||
|
rec_ex
|
||||||
|
when :recommended_assignment
|
||||||
|
exercises_user_has_accessed = user.submissions.where("cause IN ('submit','assess')").map{|s| s.exercise}.uniq.compact
|
||||||
tags_user_has_seen = exercises_user_has_accessed.map{|ex| ex.tags}.uniq.flatten
|
tags_user_has_seen = exercises_user_has_accessed.map{|ex| ex.tags}.uniq.flatten
|
||||||
Rails.logger.debug("exercises_user_has_accessed #{exercises_user_has_accessed.map{|e|e.id}.join(",")}")
|
Rails.logger.debug("exercises_user_has_accessed #{exercises_user_has_accessed.map{|e|e.id}.join(",")}")
|
||||||
|
|
||||||
@ -76,6 +89,8 @@ class ProxyExercise < ActiveRecord::Base
|
|||||||
recommended_exercise
|
recommended_exercise
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
end
|
||||||
private :find_matching_exercise
|
private :find_matching_exercise
|
||||||
|
|
||||||
def select_best_matching_exercise(user, exercises_user_has_accessed, potential_recommended_exercises)
|
def select_best_matching_exercise(user, exercises_user_has_accessed, potential_recommended_exercises)
|
||||||
|
@ -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'
|
||||||
|
@ -280,7 +280,7 @@ de:
|
|||||||
text: "Es scheint so als würden sie Probleme mit der Aufgabe haben. Wenn Sie möchten, können wir Ihnen helfen!"
|
text: "Es scheint so als würden sie Probleme mit der Aufgabe haben. Wenn Sie möchten, können wir Ihnen helfen!"
|
||||||
break_intervention:
|
break_intervention:
|
||||||
title: "Pause"
|
title: "Pause"
|
||||||
text: "Uns ist aufgefallen, dass du schon lange an dieser Aufgabe arbeitest. Möchtest du vielleicht eine Pause machen um auf neue Gedanken zu kommen?"
|
text: "Uns ist aufgefallen, dass du schon lange an dieser Aufgabe arbeitest. Möchtest du vielleicht später weiter machen um erstmal auf neue Gedanken zu kommen?"
|
||||||
index:
|
index:
|
||||||
clone: Duplizieren
|
clone: Duplizieren
|
||||||
implement: Implementieren
|
implement: Implementieren
|
||||||
|
6
db/migrate/20170323130756_add_index_to_submissions.rb
Normal file
6
db/migrate/20170323130756_add_index_to_submissions.rb
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
class AddIndexToSubmissions < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_index :submissions, :exercise_id
|
||||||
|
add_index :submissions, :user_id
|
||||||
|
end
|
||||||
|
end
|
@ -17,8 +17,10 @@
|
|||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
|
|
||||||
/* fixes for IE */
|
/* fixes for IE */
|
||||||
|
/*
|
||||||
background:white;
|
background:white;
|
||||||
opacity:0;
|
opacity:0;
|
||||||
filter:Alpha(opacity=0);
|
filter:Alpha(opacity=0);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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