changed name of intervention modal, timer in editor.js set text now. some time calculations in editor for interventions
This commit is contained in:
@ -585,11 +585,33 @@ configureEditors: function () {
|
|||||||
url: $('#editor').data('working-times-url'),
|
url: $('#editor').data('working-times-url'),
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
var percentile75 = data['working_time_75_percentile'];
|
var percentile75 = data['working_time_75_percentile'];
|
||||||
var accu = data['working_time_accumulated'];
|
var accumulatedWorkTimeUser = data['working_time_accumulated'];
|
||||||
$('#avg-working-time').text(`75th percentile: ${percentile75} and accumulated time: ${accu}`);
|
|
||||||
|
var timeUntilBreak = 15 * 60;
|
||||||
|
|
||||||
|
if ((accumulatedWorkTimeUser - percentile75) > 0) {
|
||||||
|
// working time is already over 75 percentile
|
||||||
|
var timeUntilAskQuestion = 7 * 60;
|
||||||
|
} else {
|
||||||
|
// working time is less than 75 percentile
|
||||||
|
// ensure we give user at least 10 minutes before we bother the user
|
||||||
|
var timeUntilAskQuestion = (percentile75 - accumulatedWorkTimeUser) > 10 * 60 ? (percentile75 - accumulatedWorkTimeUser) : 10 * 60;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if notifications are too close to each other, ensure some time differences between them
|
||||||
|
if (Math.abs(timeUntilAskQuestion - timeUntilBreak) < 5){
|
||||||
|
timeUntilBreak = timeUntilBreak * 2;
|
||||||
|
}
|
||||||
|
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
|
$('#intervention-text').text(`Willst du eine Pause machen? 75th percentile: ${percentile75} and accumulated time: ${accumulatedWorkTimeUser}`);
|
||||||
$('#intervention-modal').modal('show')
|
$('#intervention-modal').modal('show')
|
||||||
}, 10000);
|
}, timeUntilBreak);
|
||||||
|
|
||||||
|
setTimeout(function() {
|
||||||
|
$('#intervention-text').text(`Willst du eine Frage stellen?`);
|
||||||
|
$('#intervention-modal').modal('show')
|
||||||
|
}, timeUntilAskQuestion);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -22,4 +22,4 @@
|
|||||||
|
|
||||||
|
|
||||||
= render('shared/modal', id: 'comment-modal', title: t('exercises.implement.comment.request'), template: 'exercises/_request_comment_dialogcontent')
|
= render('shared/modal', id: 'comment-modal', title: t('exercises.implement.comment.request'), template: 'exercises/_request_comment_dialogcontent')
|
||||||
= render('shared/modal', id: 'intervention-modal', title: 'Leg mal eine Pause ein', template: 'interventions/_working_too_long')
|
= render('shared/modal', id: 'intervention-modal', title: 'Leg mal eine Pause ein', template: 'interventions/_intervention_modal')
|
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
h5 = 'Aufpassen!'
|
h5 = 'Aufpassen!'
|
||||||
/textarea.form-control#question(style='resize:none;')
|
/textarea.form-control#question(style='resize:none;')
|
||||||
p = 'Uns ist aufgefallen, dass Sie schon sehr lange an dieser Aufgabe sitzen. Wollen Sie nicht vielleicht mal eine Pause einlegen?'
|
p = 'Uns ist aufgefallen, dass Sie schon sehr lange an dieser Aufgabe sitzen.'
|
||||||
#avg-working-time
|
#intervention-text
|
||||||
|
|
||||||
/p = "AVG: #{@working_time_avg}"
|
/p = "AVG: #{@working_time_avg}"
|
||||||
/p = "ACCUMULATED: #{@working_time_accumulated}"
|
/p = "ACCUMULATED: #{@working_time_accumulated}"
|
Reference in New Issue
Block a user