admin: duration change impact the expected end

This commit is contained in:
nemunaire 2025-02-04 17:01:00 +01:00
parent 603b226955
commit 650f933993
2 changed files with 12 additions and 3 deletions

View file

@ -614,9 +614,18 @@ angular.module("FICApp")
response.enableExerciceDepend = response.unlockedChallengeDepth >= 0;
response.disabledsubmitbutton = response.disablesubmitbutton && response.disablesubmitbutton.length > 0;
if (response.end) {
$scope.duration = (response.end - response.start)/60000;
}
})
$scope.challenge = SettingsChallenge.get();
$scope.duration = 360;
$scope.durationChange = function(endChanged) {
if (endChanged)
$scope.duration = (new Date($scope.config.end).getTime() - new Date($scope.config.start).getTime())/60000;
else
$scope.config.end = new Date(new Date($scope.config.start).getTime() + $scope.duration * 60000);
}
$scope.activateTime = "";
$scope.challenge.$promise.then(function (c) {
if (c.duration)