- 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
|
||||
* */
|
||||
initializeInterventionTimer: function() {
|
||||
$.ajax({
|
||||
data: {
|
||||
exercise_id: $('#editor').data('exercise-id'),
|
||||
user_id: $('#editor').data('user-id')
|
||||
},
|
||||
dataType: 'json',
|
||||
method: 'GET',
|
||||
// get working times for this exercise
|
||||
url: $('#editor').data('working-times-url'),
|
||||
success: function (data) {
|
||||
var percentile75 = data['working_time_75_percentile'];
|
||||
var accumulatedWorkTimeUser = data['working_time_accumulated'];
|
||||
if ($('#editor').data('rfc-interventions') == true || $('#editor').data('break-interventions') == true) { // split in break or rfc intervention
|
||||
$.ajax({
|
||||
data: {
|
||||
exercise_id: $('#editor').data('exercise-id'),
|
||||
user_id: $('#editor').data('user-id')
|
||||
},
|
||||
dataType: 'json',
|
||||
method: 'GET',
|
||||
// get working times for this exercise
|
||||
url: $('#editor').data('working-times-url'),
|
||||
success: function (data) {
|
||||
var percentile75 = data['working_time_75_percentile'];
|
||||
var accumulatedWorkTimeUser = data['working_time_accumulated'];
|
||||
|
||||
var timeUntilBreak = 20 * 60 * 1000;
|
||||
var minTimeUntilAskQuestion = 15 * 60 * 1000;
|
||||
var minTimeIntervention = 10 * 60 * 1000;
|
||||
|
||||
if ((accumulatedWorkTimeUser - percentile75) > 0) {
|
||||
// working time is already over 75 percentile
|
||||
var timeUntilAskQuestion = minTimeUntilAskQuestion;
|
||||
} else {
|
||||
// working time is less than 75 percentile
|
||||
// ensure we give user at least 10 minutes before we bother the user
|
||||
var timeUntilAskForRFC = (percentile75 - accumulatedWorkTimeUser) > minTimeUntilAskQuestion ? (percentile75 - accumulatedWorkTimeUser) : minTimeUntilAskQuestion;
|
||||
if ((accumulatedWorkTimeUser - percentile75) > 0) {
|
||||
// working time is already over 75 percentile
|
||||
var timeUntilIntervention = minTimeIntervention;
|
||||
} else {
|
||||
// working time is less than 75 percentile
|
||||
// ensure we give user at least minTimeIntervention before we bother the user
|
||||
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(){
|
||||
@@ -671,9 +670,7 @@ configureEditors: function () {
|
||||
this.initializeDescriptionToggle();
|
||||
this.initializeSideBarTooltips();
|
||||
this.initializeTooltips();
|
||||
if ($('#editor').data('show-interventions') == true){
|
||||
this.initializeInterventionTimer();
|
||||
}
|
||||
this.initializeInterventionTimer();
|
||||
this.initializeSearchButton();
|
||||
this.initPrompt();
|
||||
this.renderScore();
|
||||
|
Reference in New Issue
Block a user