admin: general statistics page
This commit is contained in:
parent
ea3f3b709d
commit
bc135d00c5
|
@ -33,6 +33,10 @@ angular.module("FICApp", ["ngRoute", "ngResource", "ngSanitize"])
|
|||
controller: "TeamsListController",
|
||||
templateUrl: "views/team-print.html"
|
||||
})
|
||||
.when("/teams/export", {
|
||||
controller: "TeamsListController",
|
||||
templateUrl: "views/team-export.html"
|
||||
})
|
||||
.when("/teams/:teamId", {
|
||||
controller: "TeamController",
|
||||
templateUrl: "views/team-edit.html"
|
||||
|
@ -152,6 +156,13 @@ String.prototype.capitalize = function() {
|
|||
}
|
||||
|
||||
angular.module("FICApp")
|
||||
.filter("countHints", function() {
|
||||
return function(input) {
|
||||
if (input == undefined)
|
||||
return 0;
|
||||
return input.reduce(function(sum, n){ return sum + (n.content || n.file) ? 1 : 0; }, 0);
|
||||
}
|
||||
})
|
||||
.filter("capitalize", function() {
|
||||
return function(input) {
|
||||
if (input != undefined)
|
||||
|
@ -832,6 +843,8 @@ angular.module("FICApp")
|
|||
}
|
||||
})
|
||||
.controller("TeamController", function($scope, $rootScope, $location, Team, TeamMember, $routeParams, $http) {
|
||||
if ($scope.team && $scope.team.id)
|
||||
$routeParams.teamId = $scope.team.id;
|
||||
$scope.team = Team.get({ teamId: $routeParams.teamId });
|
||||
$scope.fields = ["name", "color"];
|
||||
|
||||
|
@ -885,7 +898,7 @@ angular.module("FICApp")
|
|||
$scope.deleteTeam = function() {
|
||||
backName = this.team.name;
|
||||
this.team.$remove(function() { $rootScope.newBox('success', 'Team ' + backName + ' successfully removed.'); $location.url("/teams/"); },
|
||||
function(response) { console.log($rootScope.newBox); $rootScope.newBox('danger', 'An error occurs during suppression of the team:', response.data); });
|
||||
function(response) { $rootScope.newBox('danger', 'An error occurs during suppression of the team:', response.data); });
|
||||
}
|
||||
$scope.showStats = function() {
|
||||
$location.url("/teams/" + $scope.team.id + "/stats");
|
||||
|
|
22
admin/static/views/team-export.html
Normal file
22
admin/static/views/team-export.html
Normal file
|
@ -0,0 +1,22 @@
|
|||
<div ng-repeat="team in teams" ng-click="show(team.id)" ng-controller="TeamController">
|
||||
<div ng-controller="TeamExercicesController">
|
||||
<div ng-if="teams[my.team_id].rank">
|
||||
<h2>{{ team.name }} <small>{{ teams[my.team_id].rank }}/{{ nb_teams }} – <ng-pluralize count="my.score" when="{'one': '{} point', 'other': '{} points'}"></ng-pluralize></small></h2>
|
||||
<div class="row">
|
||||
<div class="col-md" ng-repeat="(tid,theme) in themes">
|
||||
<h4 ng-bind="theme.name"></h4>
|
||||
<ul class="list-unstyled">
|
||||
<li ng-repeat="(eid,exercice) in theme.exercices" ng-if="my.exercices[eid] && (my.exercices[eid].tries || (my.exercices[eid].hints | countHints))">
|
||||
<nobr ng-class="{'text-info': !my.exercices[eid].tries && !my.exercices[eid].solved_rank, 'text-warning': my.exercices[eid].tries && !my.exercices[eid].solved_rank, 'text-success': my.exercices[eid].solved_rank}">
|
||||
<a href="/{{ my.exercices[eid].theme_id }}/{{ eid }}" target="_blank" title="{{ my.exercices[eid].statement }}">{{ exercice.title }}</a>
|
||||
(<span ng-if="my.exercices[eid].solved_rank" title="{{ my.exercices[eid].solved_time | date:'mediumDate' }} à {{ my.exercices[eid].solved_time | date:'mediumTime' }}">{{ my.exercices[eid].solved_rank }}<sup>e</sup> – </span><em><ng-pluralize count="my.exercices[eid].tries" when="{'one': '{} tentative', 'other': '{} tentatives'}"></ng-pluralize><span ng-if="my.exercices[eid].hints | countHints"><span ng-if="my.exercices[eid].tries"> – </span>{{ my.exercices[eid].hints | countHints }} indices</span></em>)
|
||||
</nobr>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -2,6 +2,7 @@
|
|||
Équipes
|
||||
<button ng-click="show('new')" class="float-right btn btn-sm btn-primary"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span> Ajouter une équipe</button>
|
||||
<button ng-click="show('print')" class="float-right btn btn-sm btn-secondary" style="margin-right: 10px;"><span class="glyphicon glyphicon-print" aria-hidden="true"></span> Imprimer les équipes</button>
|
||||
<button ng-click="show('export')" class="float-right btn btn-sm btn-secondary" style="margin-right: 10px;"><span class="glyphicon glyphicon-export" aria-hidden="true"></span> Statistiques générales</button>
|
||||
</h2>
|
||||
|
||||
<p><input type="search" class="form-control" placeholder="Search" ng-model="query"></p>
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
|
||||
<dl>
|
||||
<div style="float: left;padding: 0 5px; margin: 5px; border: 1px solid #ccc; border-radius: 3px; min-width: 5vw" ng-repeat="(tid,theme) in themes" class="text-center">
|
||||
<dt>{{ theme.name }}</dt>
|
||||
<dt ng-bind="theme.name"></dt>
|
||||
<dd>
|
||||
<ul class="list-unstyled">
|
||||
<li ng-repeat="(eid,exercice) in theme.exercices" ng-if="my.exercices[eid] && my.exercices[eid].solved_rank"><a href="/{{ my.exercices[eid].theme_id }}/{{ eid }}" target="_blank"><abbr title="{{ my.exercices[eid].statement }}">{{ exercice.title }}</abbr></a> (<abbr title="{{ my.exercices[eid].solved_time | date:'mediumDate' }} à {{ my.exercices[eid].solved_time | date:'mediumTime' }}">{{ my.exercices[eid].solved_rank }}<sup>e</sup></abbr>)</li>
|
||||
|
|
Loading…
Reference in New Issue
Block a user