From d743069fa9538783111660bbd9b928229759332a Mon Sep 17 00:00:00 2001 From: nikita Date: Wed, 28 Feb 2018 13:26:59 +0530 Subject: [PATCH] all is working --- 400-SOURCECODE/AIAHTML5.Web/app/controllers/LabExercController.js | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/LabExercController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/LabExercController.js index 71ec0c9..59fb487 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/LabExercController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/LabExercController.js @@ -144,6 +144,7 @@ function ($scope, $rootScope, pages, log, $http,$timeout, DataService, $filter, $.each(result.LabExercise, function (index, value) { + debugger; $scope.LabExerciseName = result.LabExercise[index].Topic; if (result.LabExercise[index].Slug == keywords.labexercise) { @@ -183,6 +184,11 @@ function ($scope, $rootScope, pages, log, $http,$timeout, DataService, $filter, if ($scope.SavedLabExercise != undefined && $scope.SavedLabExercise.lastQuestion > 0) { if ($scope.isResetClicked != true) { $scope.ShowSavedLabExercise(); + + } + else { + $rootScope.isLoading = false; + $('#spinner').css('visibility', 'hidden'); $scope.isResetClicked = false; } } @@ -321,12 +327,7 @@ function ($scope, $rootScope, pages, log, $http,$timeout, DataService, $filter, console.log($scope.usersCorrectQuestData); $("#resultLabData").empty(); var sortedQuestionHtml = ''; - $scope.usersCorrectQuestData.sort(function (obj1, obj2) { - // Ascending: first age less than the previous - return obj1.QuestionNo - obj2.QuestionNo; - }); - - + for (var j = $scope.TotalNumberofQuiz; j >= 1; j--) { for (var i = 0; i <= $scope.usersCorrectQuestData.length - 1; i++) { if (j == $scope.usersCorrectQuestData[i].QuestionNo) @@ -339,15 +340,18 @@ function ($scope, $rootScope, pages, log, $http,$timeout, DataService, $filter, var labExerciseHtml = $("#resultLabData").append("" + $scope.usersCorrectQuestData[i].QuestionNo + "" + $scope.usersCorrectQuestData[i].title + "" + $scope.usersCorrectQuestData[i].CorrectStatus + ""); $compile(labExerciseHtml)($scope); } + $scope.isValueExist = true; break; } - else + else { + $scope.isValueExist = false; + } + } + if ($scope.isValueExist == false) { var labExerciseHtml_1 = $("#resultLabData").prepend("" + j + " Incorrect"); $compile(labExerciseHtml_1)($scope); - break; } - } } for (var j = 1;j <= $scope.TotalNumberofQuiz;j++) { @@ -370,6 +374,7 @@ function ($scope, $rootScope, pages, log, $http,$timeout, DataService, $filter, $compile(sortedCompileHtml)($scope); $scope.inCorrectAnswer = 0; $scope.CorrectAnswer = 0; + $scope.scoreResult = 0; $("#resultLabData tr td:nth-child(3)").each(function () { if ($(this).text() == "Incorrect") { $scope.inCorrectAnswer = $scope.inCorrectAnswer + 1; @@ -379,6 +384,10 @@ function ($scope, $rootScope, pages, log, $http,$timeout, DataService, $filter, $scope.CorrectAnswer = $scope.CorrectAnswer + 1; } }); + + $scope.scoreResult = (parseInt($scope.CorrectAnswer) / parseInt($scope.inCorrectAnswer)) * 100; + $scope.scoreResult = Math.round($scope.scoreResult); + } @@ -560,6 +569,7 @@ function ($scope, $rootScope, pages, log, $http,$timeout, DataService, $filter, } $scope.resetQuiz = function () { + debugger; $scope.DraggedList = []; $scope.UserAttempt = []; $scope.GetQuizByTopic(); -- libgit2 0.21.4