Skip to content

Commit 18325dd

Browse files
committed
The timer counts down in every navigation mode
No idea why it was only counting down in sequence mode.
1 parent 855f5cc commit 18325dd

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

runtime/scripts/exam.js

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -867,8 +867,9 @@ Exam.prototype = /** @lends Numbas.Exam.prototype */ {
867867
this.timeRemaining = this.settings.duration;
868868
this.updateScore(); //initialise score
869869
//set countdown going
870-
if(this.mode!='review')
870+
if(this.mode!='review') {
871871
this.startTiming();
872+
}
872873

873874
switch(this.settings.navigateMode) {
874875
case 'sequence':
@@ -925,8 +926,7 @@ Exam.prototype = /** @lends Numbas.Exam.prototype */ {
925926
* @fires Numbas.Exam#event:hideTiming
926927
* @fires Numbas.Exam#event:showTiming
927928
*/
928-
startTiming: function()
929-
{
929+
startTiming: function() {
930930
this.inProgress = true;
931931
this.stopwatch = {
932932
start: new Date(),
@@ -951,12 +951,10 @@ Exam.prototype = /** @lends Numbas.Exam.prototype */ {
951951
* @fires Numbas.Exam#event:countDown
952952
* @fires Numbas.Exam#event:alert
953953
*/
954-
countDown: function()
955-
{
954+
countDown: function() {
956955
var t = new Date();
957956
this.timeSpent = this.stopwatch.oldTimeSpent + (t - this.stopwatch.start)/1000;
958-
if(this.settings.navigateMode=='sequence' && this.settings.duration > 0)
959-
{
957+
if(this.settings.duration > 0) {
960958
this.timeRemaining = Math.ceil((this.stopwatch.end - t)/1000);
961959
this.display && this.display.showTiming();
962960
this.events.trigger('showTiming');
@@ -988,8 +986,7 @@ Exam.prototype = /** @lends Numbas.Exam.prototype */ {
988986
*
989987
* @fires Numbas.Exam#event:endTiming
990988
*/
991-
endTiming: function()
992-
{
989+
endTiming: function() {
993990
this.inProgress = false;
994991
clearInterval( this.stopwatch.id );
995992
this.events.trigger('endTiming');

0 commit comments

Comments
 (0)