Commit d743069fa9538783111660bbd9b928229759332a

Authored by Nikita Kulshreshtha
1 parent cee3de39

all is working

400-SOURCECODE/AIAHTML5.Web/app/controllers/LabExercController.js
... ... @@ -144,6 +144,7 @@ function ($scope, $rootScope, pages, log, $http,$timeout, DataService, $filter,
144 144  
145 145  
146 146 $.each(result.LabExercise, function (index, value) {
  147 + debugger;
147 148 $scope.LabExerciseName = result.LabExercise[index].Topic;
148 149 if (result.LabExercise[index].Slug == keywords.labexercise) {
149 150  
... ... @@ -183,6 +184,11 @@ function ($scope, $rootScope, pages, log, $http,$timeout, DataService, $filter,
183 184 if ($scope.SavedLabExercise != undefined && $scope.SavedLabExercise.lastQuestion > 0) {
184 185 if ($scope.isResetClicked != true) {
185 186 $scope.ShowSavedLabExercise();
  187 +
  188 + }
  189 + else {
  190 + $rootScope.isLoading = false;
  191 + $('#spinner').css('visibility', 'hidden');
186 192 $scope.isResetClicked = false;
187 193 }
188 194 }
... ... @@ -321,12 +327,7 @@ function ($scope, $rootScope, pages, log, $http,$timeout, DataService, $filter,
321 327 console.log($scope.usersCorrectQuestData);
322 328 $("#resultLabData").empty();
323 329 var sortedQuestionHtml = '';
324   - $scope.usersCorrectQuestData.sort(function (obj1, obj2) {
325   - // Ascending: first age less than the previous
326   - return obj1.QuestionNo - obj2.QuestionNo;
327   - });
328   -
329   -
  330 +
330 331 for (var j = $scope.TotalNumberofQuiz; j >= 1; j--) {
331 332 for (var i = 0; i <= $scope.usersCorrectQuestData.length - 1; i++) {
332 333 if (j == $scope.usersCorrectQuestData[i].QuestionNo)
... ... @@ -339,15 +340,18 @@ function ($scope, $rootScope, pages, log, $http,$timeout, DataService, $filter,
339 340 var labExerciseHtml = $("#resultLabData").append("<tr><td>" + $scope.usersCorrectQuestData[i].QuestionNo + "</td><td>" + $scope.usersCorrectQuestData[i].title + "</td><td>" + $scope.usersCorrectQuestData[i].CorrectStatus + "</td><td><button ng-click='reviewAttemptAnswer($event);' id=" + $scope.usersCorrectQuestData[i].QuestionNo + " class='btn btn-sm' style='background-color:#d9534f;border-color:#d9534f;color:#ffffff;'><i class='fa fa-times'></i> Review</button></td></tr>");
340 341 $compile(labExerciseHtml)($scope);
341 342 }
  343 + $scope.isValueExist = true;
342 344 break;
343 345 }
344   - else
  346 + else {
  347 + $scope.isValueExist = false;
  348 + }
  349 + }
  350 + if ($scope.isValueExist == false)
345 351 {
346 352 var labExerciseHtml_1 = $("#resultLabData").prepend("<tr><td>" + j + "</td><td>&nbsp;</td><td>Incorrect</td><td><button ng-click='reviewAttemptAnswer($event);' id=" + j + " class='btn btn-danger btn-sm'><i class='fa fa-times'></i> Review</button></td></tr>");
347 353 $compile(labExerciseHtml_1)($scope);
348   - break;
349 354 }
350   - }
351 355 }
352 356  
353 357 for (var j = 1;j <= $scope.TotalNumberofQuiz;j++) {
... ... @@ -370,6 +374,7 @@ function ($scope, $rootScope, pages, log, $http,$timeout, DataService, $filter,
370 374 $compile(sortedCompileHtml)($scope);
371 375 $scope.inCorrectAnswer = 0;
372 376 $scope.CorrectAnswer = 0;
  377 + $scope.scoreResult = 0;
373 378 $("#resultLabData tr td:nth-child(3)").each(function () {
374 379 if ($(this).text() == "Incorrect") {
375 380 $scope.inCorrectAnswer = $scope.inCorrectAnswer + 1;
... ... @@ -379,6 +384,10 @@ function ($scope, $rootScope, pages, log, $http,$timeout, DataService, $filter,
379 384 $scope.CorrectAnswer = $scope.CorrectAnswer + 1;
380 385 }
381 386 });
  387 +
  388 + $scope.scoreResult = (parseInt($scope.CorrectAnswer) / parseInt($scope.inCorrectAnswer)) * 100;
  389 + $scope.scoreResult = Math.round($scope.scoreResult);
  390 +
382 391 }
383 392  
384 393  
... ... @@ -560,6 +569,7 @@ function ($scope, $rootScope, pages, log, $http,$timeout, DataService, $filter,
560 569 }
561 570  
562 571 $scope.resetQuiz = function () {
  572 + debugger;
563 573 $scope.DraggedList = [];
564 574 $scope.UserAttempt = [];
565 575 $scope.GetQuizByTopic();
... ...