Add new helper string related to justified MCQ flag

This commit is contained in:
nemunaire 2018-12-02 04:52:15 +01:00
commit c5b65289d3
10 changed files with 121 additions and 69 deletions

View file

@ -233,18 +233,20 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
angular.forEach(data.exercices, function(exercice, eid) {
angular.forEach(exercice.mcqs, function(mcq, mid) {
angular.forEach(mcq.choices, function(choice, cid) {
this[cid] = {
label: choice,
value: mcq["checks_solved"] !== undefined && mcq["checks_solved"][cid] !== undefined && mcq["checks_solved"][cid] > 0
};
if (mcq["checks_solved"] !== undefined) {
this[cid].disabled = mcq["checks_solved"][cid] === undefined || mcq["checks_solved"][cid] >= 0;
this[cid].solved = mcq["checks_solved"][cid] !== undefined && mcq["checks_solved"][cid] >= 2;
}
if (!(choice instanceof Object))
this[cid] = {
label: choice,
};
this[cid].disabled = mcq.solved || mcq.part_solved || this[cid].solved;
if (!this[cid].help)
this[cid].help = "Flag correspondant";
if (!this[cid].disabled)
this[cid].value = $scope.my && $scope.my.exercices[eid] && $scope.my.exercices[eid].mcqs[mid] && $scope.my.exercices[eid].mcqs[mid].choices[cid] && $scope.my.exercices[eid].mcqs[mid].choices[cid].value
if ($scope.my && $scope.my.exercices[eid] && $scope.my.exercices[eid].mcqs[mid] && $scope.my.exercices[eid].mcqs[mid].choices[cid]) {
if ($scope.my.exercices[eid].mcqs[mid].choices[cid].value !== undefined)
this[cid].value = $scope.my.exercices[eid].mcqs[mid].choices[cid].value;
if ($scope.my.exercices[eid].mcqs[mid].choices[cid].justify !== undefined)
this[cid].justify = $scope.my.exercices[eid].mcqs[mid].choices[cid].justify;
}

View file

@ -98,7 +98,7 @@
<div class="custom-control custom-checkbox" ng-repeat="(cid,choice) in mcq.choices" ng-if="!mcq.solved || mcq.justify">
<input class="custom-control-input" type="checkbox" id="mcq_{{k}}_{{cid}}" name="mcq_{{k}}_{{cid}}" ng-model="choice.value" ng-disabled="choice.disabled">
<label class="custom-control-label" for="mcq_{{k}}_{{cid}}" ng-bind="choice.label"></label>
<input type="text" class="form-control" autocomplete="off" placeholder="Flag correspondant" name="sol_{{ cid }}" ng-model="choice.justify" ng-if="choice.value && mcq.justify && !choice.solved">
<input type="text" class="form-control" autocomplete="off" placeholder="{{ choice.help }}" name="sol_{{ cid }}" ng-model="choice.justify" ng-if="choice.value && mcq.justify && !choice.solved">
<span ng-if="choice.value && mcq.justify && choice.solved" ng-bind="choice.justify"></span>
<span class="glyphicon glyphicon-ok form-control-feedback text-success" aria-hidden="true" ng-if="choice.solved" title="Flag trouvé !"></span>
</div>