Commit d743069fa9538783111660bbd9b928229759332a
1 parent
cee3de39
all is working
Showing
1 changed file
with
19 additions
and
9 deletions
400-SOURCECODE/AIAHTML5.Web/app/controllers/LabExercController.js
@@ -144,6 +144,7 @@ function ($scope, $rootScope, pages, log, $http,$timeout, DataService, $filter, | @@ -144,6 +144,7 @@ function ($scope, $rootScope, pages, log, $http,$timeout, DataService, $filter, | ||
144 | 144 | ||
145 | 145 | ||
146 | $.each(result.LabExercise, function (index, value) { | 146 | $.each(result.LabExercise, function (index, value) { |
147 | + debugger; | ||
147 | $scope.LabExerciseName = result.LabExercise[index].Topic; | 148 | $scope.LabExerciseName = result.LabExercise[index].Topic; |
148 | if (result.LabExercise[index].Slug == keywords.labexercise) { | 149 | if (result.LabExercise[index].Slug == keywords.labexercise) { |
149 | 150 | ||
@@ -183,6 +184,11 @@ function ($scope, $rootScope, pages, log, $http,$timeout, DataService, $filter, | @@ -183,6 +184,11 @@ function ($scope, $rootScope, pages, log, $http,$timeout, DataService, $filter, | ||
183 | if ($scope.SavedLabExercise != undefined && $scope.SavedLabExercise.lastQuestion > 0) { | 184 | if ($scope.SavedLabExercise != undefined && $scope.SavedLabExercise.lastQuestion > 0) { |
184 | if ($scope.isResetClicked != true) { | 185 | if ($scope.isResetClicked != true) { |
185 | $scope.ShowSavedLabExercise(); | 186 | $scope.ShowSavedLabExercise(); |
187 | + | ||
188 | + } | ||
189 | + else { | ||
190 | + $rootScope.isLoading = false; | ||
191 | + $('#spinner').css('visibility', 'hidden'); | ||
186 | $scope.isResetClicked = false; | 192 | $scope.isResetClicked = false; |
187 | } | 193 | } |
188 | } | 194 | } |
@@ -321,12 +327,7 @@ function ($scope, $rootScope, pages, log, $http,$timeout, DataService, $filter, | @@ -321,12 +327,7 @@ function ($scope, $rootScope, pages, log, $http,$timeout, DataService, $filter, | ||
321 | console.log($scope.usersCorrectQuestData); | 327 | console.log($scope.usersCorrectQuestData); |
322 | $("#resultLabData").empty(); | 328 | $("#resultLabData").empty(); |
323 | var sortedQuestionHtml = ''; | 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 | for (var j = $scope.TotalNumberofQuiz; j >= 1; j--) { | 331 | for (var j = $scope.TotalNumberofQuiz; j >= 1; j--) { |
331 | for (var i = 0; i <= $scope.usersCorrectQuestData.length - 1; i++) { | 332 | for (var i = 0; i <= $scope.usersCorrectQuestData.length - 1; i++) { |
332 | if (j == $scope.usersCorrectQuestData[i].QuestionNo) | 333 | if (j == $scope.usersCorrectQuestData[i].QuestionNo) |
@@ -339,15 +340,18 @@ function ($scope, $rootScope, pages, log, $http,$timeout, DataService, $filter, | @@ -339,15 +340,18 @@ function ($scope, $rootScope, pages, log, $http,$timeout, DataService, $filter, | ||
339 | 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 | 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 | $compile(labExerciseHtml)($scope); | 341 | $compile(labExerciseHtml)($scope); |
341 | } | 342 | } |
343 | + $scope.isValueExist = true; | ||
342 | break; | 344 | break; |
343 | } | 345 | } |
344 | - else | 346 | + else { |
347 | + $scope.isValueExist = false; | ||
348 | + } | ||
349 | + } | ||
350 | + if ($scope.isValueExist == false) | ||
345 | { | 351 | { |
346 | var labExerciseHtml_1 = $("#resultLabData").prepend("<tr><td>" + j + "</td><td> </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>"); | 352 | var labExerciseHtml_1 = $("#resultLabData").prepend("<tr><td>" + j + "</td><td> </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 | $compile(labExerciseHtml_1)($scope); | 353 | $compile(labExerciseHtml_1)($scope); |
348 | - break; | ||
349 | } | 354 | } |
350 | - } | ||
351 | } | 355 | } |
352 | 356 | ||
353 | for (var j = 1;j <= $scope.TotalNumberofQuiz;j++) { | 357 | for (var j = 1;j <= $scope.TotalNumberofQuiz;j++) { |
@@ -370,6 +374,7 @@ function ($scope, $rootScope, pages, log, $http,$timeout, DataService, $filter, | @@ -370,6 +374,7 @@ function ($scope, $rootScope, pages, log, $http,$timeout, DataService, $filter, | ||
370 | $compile(sortedCompileHtml)($scope); | 374 | $compile(sortedCompileHtml)($scope); |
371 | $scope.inCorrectAnswer = 0; | 375 | $scope.inCorrectAnswer = 0; |
372 | $scope.CorrectAnswer = 0; | 376 | $scope.CorrectAnswer = 0; |
377 | + $scope.scoreResult = 0; | ||
373 | $("#resultLabData tr td:nth-child(3)").each(function () { | 378 | $("#resultLabData tr td:nth-child(3)").each(function () { |
374 | if ($(this).text() == "Incorrect") { | 379 | if ($(this).text() == "Incorrect") { |
375 | $scope.inCorrectAnswer = $scope.inCorrectAnswer + 1; | 380 | $scope.inCorrectAnswer = $scope.inCorrectAnswer + 1; |
@@ -379,6 +384,10 @@ function ($scope, $rootScope, pages, log, $http,$timeout, DataService, $filter, | @@ -379,6 +384,10 @@ function ($scope, $rootScope, pages, log, $http,$timeout, DataService, $filter, | ||
379 | $scope.CorrectAnswer = $scope.CorrectAnswer + 1; | 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,6 +569,7 @@ function ($scope, $rootScope, pages, log, $http,$timeout, DataService, $filter, | ||
560 | } | 569 | } |
561 | 570 | ||
562 | $scope.resetQuiz = function () { | 571 | $scope.resetQuiz = function () { |
572 | + debugger; | ||
563 | $scope.DraggedList = []; | 573 | $scope.DraggedList = []; |
564 | $scope.UserAttempt = []; | 574 | $scope.UserAttempt = []; |
565 | $scope.GetQuizByTopic(); | 575 | $scope.GetQuizByTopic(); |