Able to sync and export standalone exercices

This commit is contained in:
nemunaire 2024-03-15 17:46:50 +01:00
parent 76f830b332
commit adb0e36dd4
15 changed files with 159 additions and 31 deletions

View file

@ -1840,11 +1840,18 @@ angular.module("FICApp")
url: "api/themes.json",
method: "GET"
}).then(function(response) {
$scope.themes = response.data
for (var k in $scope.themes[$scope.exercice.id_theme].exercices) {
var exercice = $scope.themes[$scope.exercice.id_theme].exercices[k];
$scope.my_ex_num[exercice.id] = k;
}
$scope.themes = response.data;
if ($scope.exercice.id_theme) {
for (var k in $scope.themes[$scope.exercice.id_theme].exercices) {
var exercice = $scope.themes[$scope.exercice.id_theme].exercices[k];
$scope.my_ex_num[exercice.id] = k;
}
} else {
for (var k in $scope.themes["0"].exercices) {
var exercice = $scope.themes["0"].exercices[k];
$scope.my_ex_num[exercice.id] = k;
}
}
});
$scope.exercices = Exercice.query();
$scope.fields = ["title", "urlid", "authors", "disabled", "statement", "headline", "overview", "finished", "depend", "gain", "coefficient", "videoURI", "image", "resolution", "issue", "issuekind", "wip"];
@ -1853,7 +1860,7 @@ angular.module("FICApp")
$scope.syncExo = function() {
$scope.inSync = true;
$http({
url: "api/sync/themes/" + $scope.exercice.id_theme + "/exercices/" + $routeParams.exerciceId,
url: $scope.exercice.id_theme?("api/sync/themes/" + $scope.exercice.id_theme + "/exercices/" + $routeParams.exerciceId):("api/sync/exercices/" + $routeParams.exerciceId),
method: "POST"
}).then(function(response) {
$scope.inSync = false;