admin: add some stats about exercices

This commit is contained in:
nemunaire 2020-01-29 15:57:34 +01:00
parent 007efc6118
commit 5df1cc6e93
5 changed files with 104 additions and 8 deletions

View file

@ -247,6 +247,9 @@ angular.module("FICApp")
.factory("ExerciceHistory", function($resource) {
return $resource("/api/exercices/:exerciceId/history.json", { exerciceId: '@id' })
})
.factory("ExercicesStats", function($resource) {
return $resource("/api/themes/:themeId/exercices_stats.json", { themeId: '@id' })
})
.factory("ExerciceStats", function($resource) {
return $resource("/api/exercices/:exerciceId/stats.json", { exerciceId: '@id' })
})
@ -519,7 +522,6 @@ angular.module("FICApp")
var refreshSyncReport = function() {
needRefreshSyncReportWhenReady = false;
$http.get("full_import_report.json").then(function(response) {
console.log(response.data);
$scope.syncReport = response.data;
})
};
@ -1404,12 +1406,12 @@ angular.module("FICApp")
$scope.syncHints = true;
$scope.syncFlags = true;
})
.controller("ExercicesListController", function($scope, ThemedExercice, $routeParams, $location, $rootScope, $http) {
$scope.exercices = ThemedExercice.query({ themeId: $routeParams.themeId });
.controller("ExercicesListController", function($scope, ThemedExercice, $location, $rootScope, $http) {
$scope.exercices = ThemedExercice.query({ themeId: $scope.theme.id });
$scope.fields = ["title", "headline", "issue"];
$scope.show = function(id) {
$location.url("/themes/" + $routeParams.themeId + "/exercices/" + id);
$location.url("/themes/" + $scope.theme.id + "/exercices/" + id);
};
$scope.inSync = false;
@ -1420,7 +1422,7 @@ angular.module("FICApp")
method: "POST"
}).then(function(response) {
$scope.inSync = false;
$scope.exercices = ThemedExercice.query({ themeId: $routeParams.themeId });
$scope.exercices = ThemedExercice.query({ themeId: $scope.theme.id });
$rootScope.staticFilesNeedUpdate++;
if (response.data)
$rootScope.newBox('warning', null, response.data, -1);
@ -1500,6 +1502,10 @@ angular.module("FICApp")
}
})
.controller("ExercicesStatsController", function($scope, ExercicesStats) {
$scope.exercices = ExercicesStats.query({ themeId: $scope.theme.id });
})
.controller("ExerciceStatsController", function($scope, ExerciceStats, $routeParams) {
$scope.stats = ExerciceStats.get({ exerciceId: $routeParams.exerciceId });
})