From 4c9a3687a827dd2d2aad0e8dae70aca38e494780 Mon Sep 17 00:00:00 2001 From: nikita Date: Fri, 21 Sep 2018 11:26:30 +0530 Subject: [PATCH] mered LabExerciseCode --- 400-SOURCECODE/AIAHTML5.Web/app/controllers/LabExercController.js | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 54 insertions(+), 7 deletions(-) diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/LabExercController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/LabExercController.js index 8720462..75766f3 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/LabExercController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/LabExercController.js @@ -15,7 +15,7 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, $scope.LabExerciseUserData = []; $scope.LabExercise = []; $scope.dragableId = ""; - $scope.UserAttempt = []; + $scope.blReviewAttempt = false; $scope.isResetClicked = false; $scope.$on('$viewContentLoaded', function (event) { @@ -307,7 +307,7 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, $scope.CreateLabExerciseDataToSave(); } $scope.dragableId = ""; - $scope.UserAttempt = []; + // $scope.UserAttempt = []; if ($scope.quiznumber == 1) return; else @@ -370,15 +370,51 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, $("#resultLabData").empty(); var sortedQuestionHtml = ''; + + + + + // console.log($scope.SavedLabExercise); + + $scope.usersCorrectQuestDataArray = []; + + for (var j = 0; j <= $scope.usersCorrectQuestData.length - 1; j++) { + + for (var i = 0; i <= $scope.SavedLabExercise.labExercise.length - 1; i++) { + + if ($scope.SavedLabExercise.labExercise[i].QuestionNo == $scope.usersCorrectQuestData[j].QuestionNo) { + // alert($scope.SavedLabExercise.labExercise[i].QuestionNo + " " + $scope.usersCorrectQuestData[j].QuestionNo); + } + else { + + if ($scope.SavedLabExercise.labExercise[i].MaxScore == $scope.SavedLabExercise.labExercise[i].Score) { + $scope.usersCorrectQuestDataArray.push({ "CorrectAnswer": $scope.SavedLabExercise.labExercise[i].CorrectAnswers, "CorrectStatus": "Correct", "DragItems": $scope.SavedLabExercise.labExercise[i].DragItems, "MaxScore": $scope.SavedLabExercise.labExercise[i].MaxScore, "QuestionNo": $scope.SavedLabExercise.labExercise[i].QuestionNo, "Score": $scope.SavedLabExercise.labExercise[i].Score, "UserAnswers": $scope.SavedLabExercise.labExercise[i].UserAnswers, "title": " " }); + + } + else { + $scope.usersCorrectQuestDataArray.push({ "CorrectAnswer": $scope.SavedLabExercise.labExercise[i].CorrectAnswers, "CorrectStatus": "Incorrect", "DragItems": $scope.SavedLabExercise.labExercise[i].DragItems, "MaxScore": $scope.SavedLabExercise.labExercise[i].MaxScore, "QuestionNo": $scope.SavedLabExercise.labExercise[i].QuestionNo, "Score": $scope.SavedLabExercise.labExercise[i].Score, "UserAnswers": $scope.SavedLabExercise.labExercise[i].UserAnswers, "title": " " }); + } + } + } + } + console.log($scope.usersCorrectQuestDataArray); + for (var i = 0; i <= $scope.usersCorrectQuestDataArray.length - 1; i++) { + $scope.usersCorrectQuestData.push({ "CorrectAnswer": $scope.usersCorrectQuestDataArray[i].CorrectAnswer, "CorrectStatus": $scope.usersCorrectQuestDataArray[i].CorrectStatus, "DragItems": $scope.usersCorrectQuestDataArray[i].DragItems, "MaxScore": $scope.usersCorrectQuestDataArray[i].MaxScore, "QuestionNo": $scope.usersCorrectQuestDataArray[i].QuestionNo, "Score": $scope.usersCorrectQuestDataArray[i].Score, "UserAnswers": $scope.usersCorrectQuestDataArray[i].UserAnswers, "title": " " }); + } + + //console.log($scope.usersCorrectQuestData); + + + for (var j = $scope.TotalNumberofQuiz; j >= 1; j--) { for (var i = 0; i <= $scope.usersCorrectQuestData.length - 1; i++) { if (j == $scope.usersCorrectQuestData[i].QuestionNo) { if ($scope.usersCorrectQuestData[i].CorrectStatus == "Correct") { - var labExerciseHtml = $("#resultLabData").append("" + $scope.usersCorrectQuestData[i].QuestionNo + "" + $scope.usersCorrectQuestData[i].title + "" + $scope.usersCorrectQuestData[i].CorrectStatus + ""); + var labExerciseHtml = $("#resultLabData").append("" + $scope.usersCorrectQuestData[i].QuestionNo + "" + $scope.usersCorrectQuestData[i].title + "" + $scope.usersCorrectQuestData[i].CorrectStatus + ""); $compile(labExerciseHtml)($scope); } else { - var labExerciseHtml = $("#resultLabData").append("" + $scope.usersCorrectQuestData[i].QuestionNo + "" + $scope.usersCorrectQuestData[i].title + "" + $scope.usersCorrectQuestData[i].CorrectStatus + ""); + var labExerciseHtml = $("#resultLabData").append("" + $scope.usersCorrectQuestData[i].QuestionNo + "" + $scope.usersCorrectQuestData[i].title + "" + $scope.usersCorrectQuestData[i].CorrectStatus + ""); $compile(labExerciseHtml)($scope); } $scope.isValueExist = true; @@ -399,10 +435,10 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, if (j == $(this).text()) { $q = $(this).parent(); if ($q.find("td:nth-child(3)").text() == "Correct") { - sortedQuestionHtml += '' + $q.find("td:nth-child(1)").text() + '' + $q.find("td:nth-child(2)").text() + '' + $q.find("td:nth-child(3)").text() + ''; + sortedQuestionHtml += '' + $q.find("td:nth-child(1)").text() + '' + $q.find("td:nth-child(2)").text() + '' + $q.find("td:nth-child(3)").text() + ''; } else { - sortedQuestionHtml += '' + $q.find("td:nth-child(1)").text() + '' + $q.find("td:nth-child(2)").text() + '' + $q.find("td:nth-child(3)").text() + ''; + sortedQuestionHtml += '' + $q.find("td:nth-child(1)").text() + '' + $q.find("td:nth-child(2)").text() + '' + $q.find("td:nth-child(3)").text() + ''; } } }); @@ -429,7 +465,10 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, if ($(this).text().length == 1) { var a = parseInt($(this).prev().text()) - 1; $(this).text($scope.labExerciseModuleData[0].Questions[a].activityTitle); - $(this).next().text("Not Attempted"); + //if ($(this).next().text() == "Correct") { $(this).next().text("Correct"); } + //else { + // $(this).next().text("Incorrect"); + //} } }); } @@ -883,6 +922,14 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, $scope.usersCorrectQuestData = []; $scope.CreateLabExerciseDataToSave = function () { + if ($scope.UserAttempt.length == 0) { + $("#imgdiv").find("div").each(function () { + if ($(this).attr("id").split("-")[0] == "blockans") { + $scope.UserAttempt.push({ "BlankBoxName": $(this).attr("id").split("-")[1], "OptionName": $(this).attr("draggedattr").split("-")[1] }); + } + }); + } + $scope.LabExerciseAttemptedData = []; $scope.lb = []; //get user answers -- libgit2 0.21.4