Index: lams_monitoring/web/timeLimit5.jsp =================================================================== diff -u -r87c236112358ed9c229876a63816b5e14b17f2af -r37b363449af76aa235b431c3746514f8fd8193f5 --- lams_monitoring/web/timeLimit5.jsp (.../timeLimit5.jsp) (revision 87c236112358ed9c229876a63816b5e14b17f2af) +++ lams_monitoring/web/timeLimit5.jsp (.../timeLimit5.jsp) (revision 37b363449af76aa235b431c3746514f8fd8193f5) @@ -54,6 +54,7 @@ absoluteTimeLimitFinish = ; $(document).ready(function(){ + let timeLimitWidget = $('#time-limit-widget'), timeLimitContent = $('#time-limit-widget-content', timeLimitWidget) .on('hidden.bs.collapse', function () { @@ -375,6 +376,8 @@ } else { counters.countdown('resume'); } + + refreshInidividualTimeLimits(); } function timeLimitFinishNow(){ @@ -439,14 +442,18 @@ }, success : function(users) { // remove existing time limits + $('.time-limit-widget-individual-counter').countdown('destroy'); $('.individual-time-limit-row', table).remove(); + let timeLimitWidget = $('#time-limit-widget'), + individualExtensionContainer = $('#time-limit-widget-individual', timeLimitWidget).empty(); if (!users) { return; } - var template = $('#individual-time-limit-template-row'), + let template = $('#individual-time-limit-template-row'), now = new Date().getTime(); + $.each(users, function(){ var row = template.clone() .attr('id', 'individual-time-limit-row-' + this.userId) @@ -456,8 +463,26 @@ .appendTo(table); $('.individual-time-limit-user-name', row).text(this.name); $('.individual-time-limit-value', row).text(this.adjustment); - row.removeClass('d-none'); + + if (this.adjustment === 0){ + return true; + } + let secondsLeft = absoluteTimeLimitFinish - Math.round(now / 1000) + this.adjustment * 60; + if (secondsLeft <= 0){ + return true; + } + + let widgetRow = $('
').appendTo(individualExtensionContainer); + $('
').text(this.name).appendTo(widgetRow); + $('
').appendTo(widgetRow) + .countdown({ + until: '+' + secondsLeft +'S', + format: 'hMS', + compact: true, + alwaysExpire : true, + expiryText : '' + }); }); } }); @@ -652,6 +677,7 @@ + @@ -710,6 +736,7 @@
+
+ +
+
\ No newline at end of file