diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/LabExercController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/LabExercController.js index ff3adf5..e77ec03 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/LabExercController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/LabExercController.js @@ -495,7 +495,8 @@ function ($scope, $rootScope, pages, log, $http,$timeout, DataService, $filter, $scope.b = $scope.DraggedList[inx1].blockID; $scope.DraggedList.splice(inx1, 1); $('#' + $scope.b).css({ "display": "block", "color": "#000000!important" }); - $('#blockans-' + $scope.b.split('-')[1]).css("background-color","transparent !important"); + $('#blockans-' + $scope.b.split('-')[1]).css("background-color", "transparent !important"); + // alert('removed from dropbox= '+'blockans-' + $scope.b.split('-')[1]); } }); } @@ -741,8 +742,8 @@ function ($scope, $rootScope, pages, log, $http,$timeout, DataService, $filter, CorrectAnswer: JSON.stringify($scope.correctResponseForSavingDatabase), DragItems: $scope.DragItems, Score: $scope.Score, - title: $scope.activityTitle - + title: $scope.activityTitle, + DragList: $scope.DraggedList } @@ -974,6 +975,7 @@ function ($scope, $rootScope, pages, log, $http,$timeout, DataService, $filter, var lastQuestion = $scope.quiznumber; var lastQuestionDetails; var lastQuestionAnswers; + var blockIds = []; //if user opted this question, it will have entry in LabExerciseUserData var thisQuestiondataInLabExerciseUserData = new jinqJs() @@ -983,6 +985,7 @@ function ($scope, $rootScope, pages, log, $http,$timeout, DataService, $filter, //if this exists in LabExerciseUserData, show the new opted else show from database + var isFromDB = false; if (thisQuestiondataInLabExerciseUserData.length > 0){ @@ -992,7 +995,7 @@ function ($scope, $rootScope, pages, log, $http,$timeout, DataService, $filter, } else{ - + isFromDB = true; lastQuestionDetails = new jinqJs() .from($scope.SavedLabExercise.labExercise) .where('QuestionNo == ' + lastQuestion) @@ -1006,20 +1009,29 @@ function ($scope, $rootScope, pages, log, $http,$timeout, DataService, $filter, var num = i + 1; $scope.QustionAnsKeyValue.push({ blockbox: 'T' + num, text: lastQuestionAnswers[i] }); - if (lastQuestionAnswers[i] != "") { - var blocks = $("div[id*='block-']"); - for (var j = 0; j < blocks.length; j++) { + if (isFromDB) { - if ((blocks[j].innerHTML).toString() == lastQuestionAnswers[i]) { - $('#' + blocks[j].id).css("display", "none"); - }; + if (lastQuestionAnswers[i] != "") { + var blocks = $("div[id*='block-']"); + for (var j = 0; j < blocks.length; j++) { - } + if ((blocks[j].innerHTML).toString() == lastQuestionAnswers[i]) { + $('#' + blocks[j].id).css("display", "none"); + }; + } + + } } - } + else { + var dragList = lastQuestionDetails[0].DragList; + angular.forEach(dragList, function (v, k) { + $('#' + v.blockID).css("display", "none"); + }) + } + } var labQuestionData = new jinqJs() .from($scope.LabExData.LabExercise[0].Questions) .where('Number == ' + lastQuestion) @@ -1036,8 +1048,13 @@ function ($scope, $rootScope, pages, log, $http,$timeout, DataService, $filter, .from(labQuestionData[0].Options) .where('OptionTitle == ' + value.text) .select(); - + + var blockId = 'block-' + OptionList[0].OptionNumber; + if (OptionList != undefined && OptionList.length > 1 && blockIds.indexOf(blockId) != -1) { + blockId = 'block-' + OptionList[1].OptionNumber; + } + blockIds.push(blockId); $scope.DraggedList.push({ "blockID": blockId, "id": value.blockbox, "optionName": value.blockbox, "Value": value.text, "topcoord": questionOptionBox[0].topcoord, "leftcoord": questionOptionBox[0].leftcoord }); diff --git a/400-SOURCECODE/AIAHTML5.Web/app/views/LabExerc/lab-exercises-detail.html b/400-SOURCECODE/AIAHTML5.Web/app/views/LabExerc/lab-exercises-detail.html index 82d72bb..be8aefb 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/views/LabExerc/lab-exercises-detail.html +++ b/400-SOURCECODE/AIAHTML5.Web/app/views/LabExerc/lab-exercises-detail.html @@ -52,7 +52,7 @@
{{optionbox.Answervalue}}
-
{{ans.Value}}
+
{{ans.Value}}