dashboard: more gradient

This commit is contained in:
nemunaire 2019-03-27 00:28:41 +01:00
parent e7900cc5ac
commit 573a95a564
2 changed files with 4 additions and 7 deletions

View file

@ -55,12 +55,12 @@
<div class="card-body"> <div class="card-body">
<h5 class="card-title" ng-controller="PingController"> <h5 class="card-title" ng-controller="PingController">
<span class="login" title="{{ student.login }}">{{ student.login }}</span> <span class="login" title="{{ student.login }}">{{ student.login }}</span>
<span class="badge float-right" ng-class="{'badge-success': PING, 'badge-danger': !PING && !PINGi && PINGw, 'badge-warning': !PING && PINGi, 'badge-dark': !PING && !PINGi && !PINGw}" title="{{ PING_time }}"> <span class="badge float-right" ng-class="{'badge-success': PING && PING < 120, 'badge-info': PING >= 120 && PING < 300, 'badge-warning': PING >= 300 && PING < 900, 'badge-danger': PING >= 900, 'badge-dark': !PING}" title="{{ PING_time }}">
&#x1f4bb; &#x1f4bb;
</span> </span>
</h5> </h5>
<div ng-controller="ProgressionController"> <div ng-controller="ProgressionController">
<span class="badge ml-1" ng-repeat="(ch,t) in tuto_progress[tutoid]" ng-class="{'badge-success': mychallenges[ch] && mychallenges[ch].recent, 'badge-warning': mychallenges[ch] && !mychallenges[ch].recent, 'badge-danger': !mychallenges[ch]}" title="{{ t.title }} @ {{ mychallenges[ch].time | date: 'medium' }}" ng-bind="t.label"></span> <span class="badge ml-1" ng-repeat="(ch,t) in tuto_progress[tutoid]" ng-class="{'badge-warning': mychallenges[ch] && mychallenges[ch].recent && mychallenges[ch].recent > 300, 'badge-info': mychallenges[ch] && mychallenges[ch].recent && mychallenges[ch].recent <= 300 && mychallenges[ch].recent >= 120, 'badge-success': mychallenges[ch] && mychallenges[ch].recent && mychallenges[ch].recent < 120, 'badge-danger': !mychallenges[ch]}" title="{{ t.title }} @ {{ mychallenges[ch].time | date: 'medium' }} {{ mychallenges[ch].recent }}" ng-bind="t.label"></span>
</div> </div>
</div> </div>
</div> </div>

View file

@ -48,9 +48,7 @@ angular.module("AdLinApp")
var refreshPing = function() { var refreshPing = function() {
$http.get("/api/students/" + $scope.student.id + "/ping").then(function(response) { $http.get("/api/students/" + $scope.student.id + "/ping").then(function(response) {
$scope.PING_time = new Date(response.data); $scope.PING_time = new Date(response.data);
$scope.PINGw = new Date(Date.now() - 864000000) < $scope.PING_time; $scope.PING = (Date.now() - $scope.PING_time)/1000;
$scope.PINGi = new Date(Date.now() - 900000) < $scope.PING_time;
$scope.PING = new Date(Date.now() - 90000) < $scope.PING_time;
}); });
} }
refreshPing(); refreshPing();
@ -99,12 +97,11 @@ angular.module("AdLinApp")
$scope.tuto_progress = tuto_progress; $scope.tuto_progress = tuto_progress;
$scope.mychallenges = {}; $scope.mychallenges = {};
var refreshChal = function() { var refreshChal = function() {
var recent = new Date(Date.now() - 120000);
$http.get("/api/students/" + $scope.student.id + "/progress").then(function(response) { $http.get("/api/students/" + $scope.student.id + "/progress").then(function(response) {
angular.forEach(response.data, function(ch, chid) { angular.forEach(response.data, function(ch, chid) {
if (ch.time) { if (ch.time) {
response.data[chid].time = new Date(ch.time); response.data[chid].time = new Date(ch.time);
response.data[chid].recent = recent < response.data[chid].time; response.data[chid].recent = (Date.now() - response.data[chid].time)/1000;
} }
}); });
$scope.mychallenges = response.data $scope.mychallenges = response.data