diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/LabExercController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/LabExercController.js index fae6ae7..e77ec03 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/LabExercController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/LabExercController.js @@ -461,18 +461,7 @@ function ($scope, $rootScope, pages, log, $http,$timeout, DataService, $filter, var x = $("#droppable").offset(); var id = $(this).attr("id"); - - // $scope.dragableText = $("#" + $scope.dragableId).text(); - - //$rootScope.selectedDivArray.push({ - // "questionNo": $scope.quiznumber, - // "draggedID": $scope.dragableId, - // "draggedText": $scope.dragableText, - // "droppedID": id - //}); - - - //console.log($rootScope.selectedDivArray); + var keywords = $location.search(); @@ -506,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]); } }); } @@ -752,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 } @@ -985,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() @@ -994,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){ @@ -1003,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) @@ -1017,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) @@ -1043,7 +1044,21 @@ function ($scope, $rootScope, pages, log, $http,$timeout, DataService, $filter, .select(); if (value.text != "") { - $scope.DraggedList.push({ "id": value.blockbox, "optionName": value.blockbox, "Value": value.text, "topcoord": questionOptionBox[0].topcoord, "leftcoord": questionOptionBox[0].leftcoord }); + var OptionList = new jinqJs() + .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 }); + + + // $scope.DraggedList.push({ "id": value.blockbox, "optionName": value.blockbox, "Value": value.text, "topcoord": questionOptionBox[0].topcoord, "leftcoord": questionOptionBox[0].leftcoord }); $rootScope.isLoading = false; $('#spinner').css('visibility', 'hidden'); 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 @@
-