Issue #46 - Added behat tests for the warning bar. Fixed failing unit tests for Moodle 27 28 and 29. Fixed javascript not considering stop time of an outage related to Issue #53.

This commit is contained in:
Daniel Thee Roperto
2016-09-27 16:05:38 +10:00
parent 6a78557487
commit 58eeaccc75
7 changed files with 193 additions and 17 deletions

View File

@@ -78,9 +78,18 @@ var auth_outage_warningbar = {
xmlhttp.open("GET", this.checkfinishedurl, true);
xmlhttp.send();
var estimatedServerTime = this.servertime + (Date.now() - this.clienttime);
var sleepSeconds = this.stops - estimatedServerTime; // How long to sleep until it stops.
if (sleepSeconds <= 0) {
sleepSeconds = 5; // It should be back, keep checking every 5 seconds.
}
else {
sleepSeconds = Math.min(sleepSeconds, (5 * 60)); // Check at least every 5 minutes.
}
setTimeout(function () {
$this.tickOngoing();
}, (5 * 60 * 1000)); // Check every 5 minutes.
}, sleepSeconds * 1000);
},
ajaxCheckFinished: function (ajax) {
@@ -94,6 +103,7 @@ var auth_outage_warningbar = {
},
finish: function () {
this.finished = true;
this.divblock.className = 'auth_outage_finished_period';
if (this.finishbutton) {
this.finishbutton.style.display = 'none';