admin: Base challenge start on server time
This commit is contained in:
parent
7798420d56
commit
81cd6fe3a1
@ -520,7 +520,7 @@ angular.module("FICApp")
|
||||
$scope.v = Version.get();
|
||||
})
|
||||
|
||||
.controller("TimestampController", function($scope, $interval, Timestamp) {
|
||||
.controller("TimestampController", function($scope, $interval, Timestamp) {
|
||||
$scope.t = Timestamp.get();
|
||||
var refresh = function() {
|
||||
$scope.t = Timestamp.get();
|
||||
@ -669,7 +669,7 @@ angular.module("FICApp")
|
||||
});
|
||||
}
|
||||
$scope.launchChallenge = function() {
|
||||
var ts = Date.now() - Date.now() % 60000;
|
||||
var ts = $rootScope.getSrvTime().getTime() - $rootScope.getSrvTime().getTime() % 60000;
|
||||
var d = new Date(ts + 120000);
|
||||
this.config.start = d.toISOString();
|
||||
var f = new Date(ts + 120000 + this.duration * 60000);
|
||||
@ -684,7 +684,7 @@ angular.module("FICApp")
|
||||
$rootScope.settings.activateTime = this.activateTime;
|
||||
}
|
||||
$scope.updActivateTime = function(modulo) {
|
||||
var ts = Math.floor((new Date(this.config.end) - Date.now() - (60000 * modulo / 2)) / (60000 * modulo)) * (60000 * modulo);
|
||||
var ts = Math.floor((new Date(this.config.end) - $rootScope.getSrvTime().getTime() - (60000 * modulo / 2)) / (60000 * modulo)) * (60000 * modulo);
|
||||
var d = new Date(this.config.end) - ts;
|
||||
this.activateTime = new Date(d).toISOString();
|
||||
this.updateActivateTime();
|
||||
@ -1184,7 +1184,7 @@ angular.module("FICApp")
|
||||
$scope.display.customCountdown = {
|
||||
show: true,
|
||||
shadow: "#E8CF5C",
|
||||
end: new Date(Date.now() + 1802000).toISOString(),
|
||||
end: new Date($rootScope.getSrvTime().getTime() + 1802000).toISOString(),
|
||||
before: "Heure joyeuse : chaque résolution compte double !",
|
||||
after: "Heure joyeuse terminée !",
|
||||
}
|
||||
@ -1193,7 +1193,7 @@ angular.module("FICApp")
|
||||
$scope.display.customCountdown = {
|
||||
show: true,
|
||||
shadow: "#3DD28F",
|
||||
end: new Date(Date.now() + 902000).toISOString(),
|
||||
end: new Date($rootScope.getSrvTime().getTime() + 902000).toISOString(),
|
||||
before: "Quart d'heure facile : indices dévoilés !",
|
||||
after: "Quart d'heure facile terminée !",
|
||||
}
|
||||
@ -1201,13 +1201,13 @@ angular.module("FICApp")
|
||||
};
|
||||
|
||||
$scope.genSceneCountdownDate = function(scene, duration) {
|
||||
scene.params.end = (new Date(Date.now() + duration)).toISOString();
|
||||
scene.params.end = (new Date($rootScope.getSrvTime().getTime() + duration)).toISOString();
|
||||
}
|
||||
$scope.genCustomCountdownDate = function(duration) {
|
||||
if (duration == null) {
|
||||
$scope.display.customCountdown.end = $rootScope.settings.activateTime;
|
||||
} else {
|
||||
$scope.display.customCountdown.end = (new Date(Date.now() + duration)).toISOString();
|
||||
$scope.display.customCountdown.end = (new Date($rootScope.getSrvTime().getTime() + duration)).toISOString();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user