dashboard: rename CountdownController to TimerController

This commit is contained in:
nemunaire 2018-12-04 05:31:56 +01:00
parent deb12052b5
commit 3df8d24e33
2 changed files with 11 additions and 5 deletions

View file

@ -118,16 +118,22 @@ angular.module("FICApp")
refreshEvents()
$interval(refreshEvents, 2100);
})
.controller("CountdownController", function($scope, $interval) {
.controller("TimerController", function($scope, $rootScope, $interval) {
$scope.duration = 0;
$scope.init = function(end) {
$scope.initT(Date.parse(end)/1000);
$scope.initT(Date.parse(end));
}
$scope.initStart = function() {
$scope.$watch("settings", function(settings){
if (settings)
$scope.initT(settings.start);
})
}
$scope.initT = function(end) {
var time = angular.fromJson(sessionStorage.userService);
var srv_cur = (Date.now() + (time.cu * 1000 - time.he)) / 1000;
$scope.duration += Math.floor(end - srv_cur);
var srv_cur = new Date(Date.now() + (time.cu - time.he));
$scope.duration = Math.floor((end - srv_cur)/1000);
}
var stop = $interval(function() {