diff --git a/admin/index.go b/admin/index.go index 13cca410..cd49d7dc 100644 --- a/admin/index.go +++ b/admin/index.go @@ -115,11 +115,13 @@ const indextpl = ` {{"{{ startIn }}"}}" | - {{"{{ time.hours | time }}"}} - : - {{"{{ time.minutes | time }}"}} - : - {{"{{ time.seconds | time }}"}} + + {{"{{ time.hours | time }}"}} + : + {{"{{ time.minutes | time }}"}} + : + {{"{{ time.seconds | time }}"}} + diff --git a/admin/static/js/app.js b/admin/static/js/app.js index 53b2eb72..4a3fa857 100644 --- a/admin/static/js/app.js +++ b/admin/static/js/app.js @@ -545,7 +545,8 @@ angular.module("FICApp") response.enableExerciceDepend = response.unlockedChallengeDepth >= 0; response.disabledsubmitbutton = response.disablesubmitbutton && response.disablesubmitbutton.length > 0; $rootScope.settings.start = new Date(response.start); - $rootScope.settings.end = new Date(response.end); + if (response.end) $rootScope.settings.end = new Date(response.end); + else $rootScope.settings.end = null; $rootScope.settings.generation = new Date(response.generation); $rootScope.settings.activateTime = new Date(response.activateTime); }) @@ -581,8 +582,10 @@ angular.module("FICApp") } $scope.saveSettings = function(msg) { if (msg === undefined) { msg = 'New settings saved!'; } - var nStart = this.config.start; - var nEnd = this.config.end; + if (this.config.end == "") this.config.end = null; + + var nStart = this.config.start; + var nEnd = this.config.end; var nGen = this.config.generation; var state = this.config.enableExerciceDepend; this.config.unlockedChallengeDepth = (this.config.enableExerciceDepend?this.config.unlockedChallengeDepth:-1) @@ -602,7 +605,11 @@ angular.module("FICApp") response.enableExerciceDepend = response.unlockedChallengeDepth >= 0; response.disabledsubmitbutton = response.disablesubmitbutton && response.disablesubmitbutton.length > 0; $rootScope.settings.start = new Date(nStart); - $rootScope.settings.end = new Date(nEnd); + if (nEnd) { + $rootScope.settings.end = new Date(nEnd); + } else { + $rootScope.settings.end = null; + } $rootScope.settings.generation = new Date(nGen); }, function(response) { $scope.addToast('danger', 'An error occurs when saving settings:', response.data.errmsg); diff --git a/admin/static/js/common.js b/admin/static/js/common.js index 29eba62c..0ac92528 100644 --- a/admin/static/js/common.js +++ b/admin/static/js/common.js @@ -263,7 +263,7 @@ angular.module("FICApp") } function updTime() { - if (time && $rootScope.settings) { + if (time && $rootScope.settings && $rootScope.settings.end) { var srv_cur = new Date(Date.now() + (time.cu - time.he)); // Refresh on start/activate time reached diff --git a/dashboard/static/index.html b/dashboard/static/index.html index fbc9eb03..9172f533 100644 --- a/dashboard/static/index.html +++ b/dashboard/static/index.html @@ -510,7 +510,7 @@ -