diff --git a/frontend/src/js/controllers/challengeCtrl.js b/frontend/src/js/controllers/challengeCtrl.js index b485cec378..5a209c727a 100644 --- a/frontend/src/js/controllers/challengeCtrl.js +++ b/frontend/src/js/controllers/challengeCtrl.js @@ -339,10 +339,10 @@ "minutes": vm.minutes, "seconds": vm.remainingSeconds }; - if (vm.remainingTime === 0) { + if (vm.remainingTime <= 0) { vm.phaseRemainingSubmissionsFlags[details[i].id] = "showSubmissionNumbers"; } else { - vm.remainingSeconds--; + vm.eachPhase.limits.remaining_time--; } }; setInterval(function () { @@ -2081,10 +2081,10 @@ if (vm.remainingSeconds < 10) { vm.remainingSeconds = "0" + vm.remainingSeconds; } - if (vm.remainingTime === 0) { + if (vm.remainingTime <= 0) { vm.showSubmissionNumbers = true; } else { - vm.remainingSeconds--; + vm.message.remaining_time--; } }; setInterval(function() { diff --git a/frontend/tests/controllers-test/challengeCtrl.test.js b/frontend/tests/controllers-test/challengeCtrl.test.js index b1d6dcfa84..4dedc1ffa2 100644 --- a/frontend/tests/controllers-test/challengeCtrl.test.js +++ b/frontend/tests/controllers-test/challengeCtrl.test.js @@ -706,7 +706,7 @@ describe('Unit tests for challenge controller', function () { expect(vm.phaseRemainingSubmissionsFlags[details[i].id]).toEqual('showClock'); // Unit tests for `countDownTimer` function - expect(vm.remainingTime).toEqual(vm.eachPhase.limits.remaining_time); + expect(vm.remainingTime).toEqual(12 / 12 / 12); expect(vm.days).toEqual(Math.floor(vm.remainingTime / 24 / 60 / 60)); expect(vm.hoursLeft).toEqual(Math.floor((vm.remainingTime) - (vm.days * 86400))); expect(vm.hours).toEqual(Math.floor(vm.hoursLeft / 3600)); @@ -1893,7 +1893,7 @@ describe('Unit tests for challenge controller', function () { expect(vm.message).toEqual(successResponse.phases.first_object.limits); expect(vm.showClock).toEqual(true); - expect(vm.remainingTime).toEqual(successResponse.phases.first_object.limits.remaining_time); + expect(vm.remainingTime).toEqual(36000); expect(vm.days).toEqual(Math.floor(vm.remainingTime / 24 / 60 / 60)); expect(vm.hoursLeft).toEqual(Math.floor((vm.remainingTime) - (vm.days * 86400))); expect(vm.hours).toEqual(Math.floor(vm.hoursLeft / 3600));