admin: fix strange behaviour when deleting some items

This commit is contained in:
nemunaire 2019-07-21 21:55:36 +02:00
parent 973363b3da
commit 936ef09e33

View file

@ -1330,7 +1330,7 @@ angular.module("FICApp")
$scope.deleteFile = function() { $scope.deleteFile = function() {
this.file.$delete(function() { this.file.$delete(function() {
$scope.files.splice($scope.files.indexOf(this.file), 1); $scope.files = ExerciceFile.query({ exerciceId: $routeParams.exerciceId });
}); });
$rootScope.staticFilesNeedUpdate++; $rootScope.staticFilesNeedUpdate++;
return false; return false;
@ -1368,7 +1368,7 @@ angular.module("FICApp")
} }
$scope.deleteHint = function() { $scope.deleteHint = function() {
this.hint.$delete(function() { this.hint.$delete(function() {
$scope.hints.splice($scope.hints.indexOf(this.hint), 1); $scope.hints = ExerciceHint.query({ exerciceId: $routeParams.exerciceId });
$rootScope.staticFilesNeedUpdate++; $rootScope.staticFilesNeedUpdate++;
}, function(response) { }, function(response) {
$rootScope.newBox('danger', 'An error occurs when trying to delete hint:', response.data.errmsg); $rootScope.newBox('danger', 'An error occurs when trying to delete hint:', response.data.errmsg);
@ -1415,7 +1415,7 @@ angular.module("FICApp")
} }
$scope.deleteFlag = function() { $scope.deleteFlag = function() {
this.flag.$delete(function() { this.flag.$delete(function() {
$scope.flags.splice($scope.flags.indexOf(this.flag), 1); $scope.flags = ExerciceFlag.query({ exerciceId: $routeParams.exerciceId });
$rootScope.staticFilesNeedUpdate++; $rootScope.staticFilesNeedUpdate++;
}, function(response) { }, function(response) {
$rootScope.newBox('danger', 'An error occurs when trying to delete flag:', response.data.errmsg); $rootScope.newBox('danger', 'An error occurs when trying to delete flag:', response.data.errmsg);
@ -1473,7 +1473,7 @@ angular.module("FICApp")
} }
$scope.deleteQuiz = function() { $scope.deleteQuiz = function() {
this.q.$delete(function() { this.q.$delete(function() {
$scope.quiz.splice($scope.quiz.indexOf(this.q), 1); $scope.quiz = ExerciceMCQFlag.query({ exerciceId: $routeParams.exerciceId });
$rootScope.staticFilesNeedUpdate++; $rootScope.staticFilesNeedUpdate++;
}, function(response) { }, function(response) {
$rootScope.newBox('danger', 'An error occurs when trying to delete flag:', response.data.errmsg); $rootScope.newBox('danger', 'An error occurs when trying to delete flag:', response.data.errmsg);