implement choices_cost
This commit is contained in:
parent
f9abdd23c6
commit
476f0f553c
18 changed files with 180 additions and 24 deletions
|
@ -426,6 +426,30 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
|
|||
});
|
||||
$scope.my.exercices[$rootScope.current_exercice].submitted = true;
|
||||
};
|
||||
|
||||
$scope.wantchoices = function(kid) {
|
||||
$scope.my.exercices[$rootScope.current_exercice].flags[kid].wcsubmitted = true;
|
||||
$http({ url: "/wantchoices/" + $rootScope.current_exercice, method: "POST", data: { id: Math.floor(kid) } }).then(function(response) {
|
||||
var checkDiffWC = function() {
|
||||
$http.get("/my.json").then(function(response) {
|
||||
var my = response.data;
|
||||
if (my.exercices[$rootScope.current_exercice].flags[kid].choices)
|
||||
$rootScope.recvMy(my);
|
||||
else {
|
||||
if (cbd)
|
||||
$timeout.cancel(cbd);
|
||||
cbd = $timeout(checkDiffWC, 750);
|
||||
}
|
||||
});
|
||||
};
|
||||
checkDiffWC();
|
||||
}, function(response) {
|
||||
$scope.messageClass = {"text-danger": true};
|
||||
$scope.sberr = "Oups !";
|
||||
$scope.message = response.data.errmsg;
|
||||
$scope.my.exercices[$rootScope.current_exercice].flags[kid].wcsubmitted = false;
|
||||
});
|
||||
}
|
||||
})
|
||||
.controller("MyTeamController", function($scope, $http, $rootScope, $timeout) {
|
||||
$rootScope.current_theme = 0;
|
||||
|
|
Reference in a new issue