admin: Retrieve stats on exercices
This commit is contained in:
parent
63b4cdc622
commit
b409fa6806
10 changed files with 241 additions and 19 deletions
|
|
@ -358,6 +358,9 @@ angular.module("FICApp")
|
|||
})
|
||||
.factory("ExerciceMCQDeps", function ($resource) {
|
||||
return $resource("api/exercices/:exerciceId/quiz/:mcqId/dependancies", { exerciceId: '@idExercice', mcqId: '@id' })
|
||||
})
|
||||
.factory("ExerciceMCQStats", function ($resource) {
|
||||
return $resource("api/exercices/:exerciceId/quiz/:mcqId/statistics", { exerciceId: '@idExercice', mcqId: '@id' })
|
||||
});
|
||||
|
||||
angular.module("FICApp")
|
||||
|
|
@ -771,6 +774,20 @@ angular.module("FICApp")
|
|||
});
|
||||
};
|
||||
})
|
||||
.component('teamLink', {
|
||||
bindings: {
|
||||
idTeam: '=',
|
||||
},
|
||||
controller: function (Team) {
|
||||
var ctrl = this;
|
||||
ctrl.team = {};
|
||||
|
||||
ctrl.$onInit = function () {
|
||||
ctrl.team = Team.get({teamId: ctrl.idTeam});
|
||||
};
|
||||
},
|
||||
template: `<a href="/teams/{{ $ctrl.idTeam }}">{{ $ctrl.team.name }}</a> `
|
||||
})
|
||||
.component('repositoryUptodate', {
|
||||
bindings: {
|
||||
repository: '<',
|
||||
|
|
@ -2400,6 +2417,12 @@ angular.module("FICApp")
|
|||
}
|
||||
})
|
||||
|
||||
.controller("ExerciceMCQStatsController", function ($scope, $routeParams, ExerciceMCQStats) {
|
||||
$scope.init = function (mcq) {
|
||||
$scope.stats = ExerciceMCQStats.get({ exerciceId: $routeParams.exerciceId, mcqId: mcq.id });
|
||||
}
|
||||
})
|
||||
|
||||
.controller("TeamsListController", function ($scope, $rootScope, Team, $location, $http) {
|
||||
$scope.teams = Team.query();
|
||||
$scope.fields = ["id", "name"];
|
||||
|
|
|
|||
|
|
@ -83,9 +83,13 @@
|
|||
<div ng-controller="ExerciceFlagStatsController" ng-init="init(flag)">
|
||||
<strong>Statistiques</strong>
|
||||
<ul>
|
||||
<li>Validés : {{ stats["completed"] }}</li>
|
||||
<li>Tentés : {{ stats["tries"] }}</li>
|
||||
<li>Équipes : {{ stats["nteams"] }}</li>
|
||||
<li>Validés : {{ stats["completed"] }}</li>
|
||||
<li>Tentés : {{ stats["tries"] }}</li>
|
||||
<li>
|
||||
Équipes :
|
||||
<span ng-if="stats['teams'].length == 0">aucune</span>
|
||||
<team-link ng-repeat="team in stats['teams']" id-team="team"></team-link>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -177,6 +181,19 @@
|
|||
<dependancy ng-repeat="dep in deps" dep="dep"></dependancy>
|
||||
</ul>
|
||||
<span ng-if="deps.length == 0"> sans</span>
|
||||
<hr>
|
||||
<div ng-controller="ExerciceMCQStatsController" ng-init="init(q)">
|
||||
<strong>Statistiques</strong>
|
||||
<ul>
|
||||
<li>Validés : {{ stats["completed"] }}</li>
|
||||
<li>Tentés : {{ stats["tries"] }}</li>
|
||||
<li>
|
||||
Équipes :
|
||||
<span ng-if="stats['teams'].length == 0">aucune</span>
|
||||
<team-link ng-repeat="team in stats['teams']" id-team="team"></team-link>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
|||
Reference in a new issue