Commit 0e6369586c96b93c5995dc17bdcb5104a50e735f

Authored by Nikita Kulshreshtha
2 parents 785253ad 0ae97439

Merge branch 'SaveDropIssueLabEx' into Develop

400-SOURCECODE/AIAHTML5.Web/app/controllers/LabExercController.js
... ... @@ -461,18 +461,7 @@ function ($scope, $rootScope, pages, log, $http,$timeout, DataService, $filter,
461 461 var x = $("#droppable").offset();
462 462  
463 463 var id = $(this).attr("id");
464   -
465   - // $scope.dragableText = $("#" + $scope.dragableId).text();
466   -
467   - //$rootScope.selectedDivArray.push({
468   - // "questionNo": $scope.quiznumber,
469   - // "draggedID": $scope.dragableId,
470   - // "draggedText": $scope.dragableText,
471   - // "droppedID": id
472   - //});
473   -
474   -
475   - //console.log($rootScope.selectedDivArray);
  464 +
476 465  
477 466 var keywords = $location.search();
478 467  
... ... @@ -506,7 +495,8 @@ function ($scope, $rootScope, pages, log, $http,$timeout, DataService, $filter,
506 495 $scope.b = $scope.DraggedList[inx1].blockID;
507 496 $scope.DraggedList.splice(inx1, 1);
508 497 $('#' + $scope.b).css({ "display": "block", "color": "#000000!important" });
509   - $('#blockans-' + $scope.b.split('-')[1]).css("background-color","transparent !important");
  498 + $('#blockans-' + $scope.b.split('-')[1]).css("background-color", "transparent !important");
  499 + // alert('removed from dropbox= '+'blockans-' + $scope.b.split('-')[1]);
510 500 }
511 501 });
512 502 }
... ... @@ -752,8 +742,8 @@ function ($scope, $rootScope, pages, log, $http,$timeout, DataService, $filter,
752 742 CorrectAnswer: JSON.stringify($scope.correctResponseForSavingDatabase),
753 743 DragItems: $scope.DragItems,
754 744 Score: $scope.Score,
755   - title: $scope.activityTitle
756   -
  745 + title: $scope.activityTitle,
  746 + DragList: $scope.DraggedList
757 747 }
758 748  
759 749  
... ... @@ -985,6 +975,7 @@ function ($scope, $rootScope, pages, log, $http,$timeout, DataService, $filter,
985 975 var lastQuestion = $scope.quiznumber;
986 976 var lastQuestionDetails;
987 977 var lastQuestionAnswers;
  978 + var blockIds = [];
988 979  
989 980 //if user opted this question, it will have entry in LabExerciseUserData
990 981 var thisQuestiondataInLabExerciseUserData = new jinqJs()
... ... @@ -994,6 +985,7 @@ function ($scope, $rootScope, pages, log, $http,$timeout, DataService, $filter,
994 985  
995 986  
996 987 //if this exists in LabExerciseUserData, show the new opted else show from database
  988 + var isFromDB = false;
997 989 if (thisQuestiondataInLabExerciseUserData.length > 0){
998 990  
999 991  
... ... @@ -1003,7 +995,7 @@ function ($scope, $rootScope, pages, log, $http,$timeout, DataService, $filter,
1003 995 }
1004 996  
1005 997 else{
1006   -
  998 + isFromDB = true;
1007 999 lastQuestionDetails = new jinqJs()
1008 1000 .from($scope.SavedLabExercise.labExercise)
1009 1001 .where('QuestionNo == ' + lastQuestion)
... ... @@ -1017,20 +1009,29 @@ function ($scope, $rootScope, pages, log, $http,$timeout, DataService, $filter,
1017 1009 var num = i + 1;
1018 1010 $scope.QustionAnsKeyValue.push({ blockbox: 'T' + num, text: lastQuestionAnswers[i] });
1019 1011  
1020   - if (lastQuestionAnswers[i] != "") {
1021   - var blocks = $("div[id*='block-']");
1022   - for (var j = 0; j < blocks.length; j++) {
  1012 + if (isFromDB) {
1023 1013  
1024   - if ((blocks[j].innerHTML).toString() == lastQuestionAnswers[i]) {
1025   - $('#' + blocks[j].id).css("display", "none");
1026   - };
  1014 + if (lastQuestionAnswers[i] != "") {
  1015 + var blocks = $("div[id*='block-']");
  1016 + for (var j = 0; j < blocks.length; j++) {
1027 1017  
1028   - }
  1018 + if ((blocks[j].innerHTML).toString() == lastQuestionAnswers[i]) {
  1019 + $('#' + blocks[j].id).css("display", "none");
  1020 + };
  1021 +
  1022 + }
1029 1023  
  1024 + }
1030 1025 }
1031   - }
1032 1026  
  1027 + else {
  1028 + var dragList = lastQuestionDetails[0].DragList;
  1029 + angular.forEach(dragList, function (v, k) {
  1030 + $('#' + v.blockID).css("display", "none");
  1031 + })
  1032 + }
1033 1033  
  1034 + }
1034 1035 var labQuestionData = new jinqJs()
1035 1036 .from($scope.LabExData.LabExercise[0].Questions)
1036 1037 .where('Number == ' + lastQuestion)
... ... @@ -1043,7 +1044,21 @@ function ($scope, $rootScope, pages, log, $http,$timeout, DataService, $filter,
1043 1044 .select();
1044 1045 if (value.text != "") {
1045 1046  
1046   - $scope.DraggedList.push({ "id": value.blockbox, "optionName": value.blockbox, "Value": value.text, "topcoord": questionOptionBox[0].topcoord, "leftcoord": questionOptionBox[0].leftcoord });
  1047 + var OptionList = new jinqJs()
  1048 + .from(labQuestionData[0].Options)
  1049 + .where('OptionTitle == ' + value.text)
  1050 + .select();
  1051 +
  1052 +
  1053 + var blockId = 'block-' + OptionList[0].OptionNumber;
  1054 + if (OptionList != undefined && OptionList.length > 1 && blockIds.indexOf(blockId) != -1) {
  1055 + blockId = 'block-' + OptionList[1].OptionNumber;
  1056 + }
  1057 + blockIds.push(blockId);
  1058 + $scope.DraggedList.push({ "blockID": blockId, "id": value.blockbox, "optionName": value.blockbox, "Value": value.text, "topcoord": questionOptionBox[0].topcoord, "leftcoord": questionOptionBox[0].leftcoord });
  1059 +
  1060 +
  1061 + // $scope.DraggedList.push({ "id": value.blockbox, "optionName": value.blockbox, "Value": value.text, "topcoord": questionOptionBox[0].topcoord, "leftcoord": questionOptionBox[0].leftcoord });
1047 1062  
1048 1063 $rootScope.isLoading = false;
1049 1064 $('#spinner').css('visibility', 'hidden');
... ...
400-SOURCECODE/AIAHTML5.Web/app/views/LabExerc/lab-exercises-detail.html
... ... @@ -52,7 +52,7 @@
52 52 </div>
53 53  
54 54 <div ng-show="IsVisible" ng-repeat="optionbox in LabExerciseModules.OptionBox" droppable="true" class="droppable ui-droppable options" id="blockbox-{{optionbox.BoxName}}" ng-style="{'top':{{optionbox.topcoord}}, 'left':{{optionbox.leftcoord}},'position': 'absolute', 'width': '155px', 'height':'30px', 'border':'0px solid #333', 'background': '#E8E8E8' }">{{optionbox.Answervalue}}</div>
55   - <div draggable="true" ng-repeat="ans in DraggedList" droppable="true" class="droppable ui-droppable answerdroppable" id="blockans-{{ans.id}}" ng-style="{'top':{{ans.topcoord}}, 'left':{{ans.leftcoord}},'position': 'absolute', 'width': '158px', 'height':'30px', 'border':'0px solid #333', 'background': 'transparent','font-size': '12px','border-color':'#FF0000','padding-top':'5px'}">{{ans.Value}}</div>
  55 + <div draggable="true" ng-repeat="ans in DraggedList" droppable="true" class="droppable ui-droppable answerdroppable" id="blockans-{{ans.id}}" ng-style="{'top':{{ans.topcoord}}, 'left':{{ans.leftcoord}},'position': 'absolute', 'width': '158px', 'height':'30px', 'border':'0px solid #333', 'background': 'transparent','font-size': '12px','border-color':'#FF0000','padding-top':'4px','line-height':'1'}">{{ans.Value}}</div>
56 56 </div>
57 57  
58 58 <div class="col-sm-12" style=" margin-top: 20px; min-height:100px;" id="divoptions" droppable="true">
... ...
400-SOURCECODE/AIAHTML5.Web/content/data/json/le/qz_dat_ca.json
... ... @@ -137,7 +137,7 @@
137 137 "activityTitle": "Arteries of Lower Limb",
138 138 "OptionBox": [{"BoxName": "T1","topcoord":"98","leftcoord":"12","Answervalue":"","QuizText":""},{"BoxName": "T2","topcoord":"231","leftcoord":"12","Answervalue":"","QuizText":""},
139 139 {"BoxName": "T3","topcoord":"311","leftcoord":"12","Answervalue":"","QuizText":""},{"BoxName": "T4","topcoord":"41","leftcoord":"580","Answervalue":"","QuizText":""},
140   - {"BoxName": "T5","topcoord":"94","leftcoord":"580","Answervalue":"","QuizText":""},{"BoxName": "T6","topcoord":"403","leftcoord":"580","Answervalue":"","QuizText":""}],
  140 + {"BoxName": "T5","topcoord":"94","leftcoord":"580","Answervalue":"","QuizText":""},{"BoxName": "T6","topcoord":"404","leftcoord":"580","Answervalue":"","QuizText":""}],
141 141 "Options": [{"OptionNumber": "A","OptionTitle": "Common iliac artery","textalign":"left"},{"OptionNumber": "B","OptionTitle": "Internal iliac artery","textalign":"left"},
142 142 {"OptionNumber": "C","OptionTitle": "External iliac artery","textalign":"left"},{"OptionNumber": "D","OptionTitle": "Lateral circumflex femoral artery","textalign":"right"},
143 143 {"OptionNumber": "E","OptionTitle": "Deep femoral artery","textalign":"right"},{"OptionNumber": "F","OptionTitle": "Femoral artery","textalign":"right"}],
... ... @@ -209,7 +209,7 @@
209 209 "OptionBox": [{"BoxName": "T1","topcoord":"62","leftcoord":"8","Answervalue":"","QuizText":""},{"BoxName": "T2","topcoord":"123","leftcoord":"8","Answervalue":"","QuizText":""},
210 210 {"BoxName": "T3","topcoord":"173","leftcoord":"8","Answervalue":""},{"BoxName": "T4","topcoord":"287","leftcoord":"8","Answervalue":"","QuizText":""},
211 211 {"BoxName": "T5","topcoord":"375","leftcoord":"8","Answervalue":"","QuizText":""},{"BoxName": "T6","topcoord":"17","leftcoord":"618","Answervalue":"","QuizText":""},
212   - {"BoxName": "T7","topcoord":"296","leftcoord":"618","Answervalue":"","QuizText":""},{"BoxName": "T8","topcoord":"388","leftcoord":"618","Answervalue":"","QuizText":""}],
  212 + {"BoxName": "T7","topcoord":"295","leftcoord":"618","Answervalue":"","QuizText":""},{"BoxName": "T8","topcoord":"387","leftcoord":"618","Answervalue":"","QuizText":""}],
213 213 "Options": [{"OptionNumber": "A","OptionTitle": "Ulnar vein","textalign":"left"},{"OptionNumber": "B","OptionTitle": "Superficial palmar venous arch","textalign":"left"},
214 214 {"OptionNumber": "C","OptionTitle": "Deep palmar venous arch","textalign":"left"},{"OptionNumber": "D","OptionTitle": "Radial vein","textalign":"left"},
215 215 {"OptionNumber": "E","OptionTitle": "Brachial vein","textalign":"right"},{"OptionNumber": "F","OptionTitle": "Basilic vein","textalign":"right"}
... ...