Commit 6b4031814237c7e8d67cb29d0d4485d1879affa1

Authored by Nikita Kulshreshtha
1 parent 23b2c7a4

fixed

400-SOURCECODE/AIAHTML5.Web/app/controllers/LabExercController.js
... ... @@ -828,21 +828,45 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter,
828 828 var correctResponse = result.LabExercise[index].Questions[index1].correctResponse;
829 829 var Options = result.LabExercise[index].Questions[index1].Options;
830 830 $.each(correctResponse, function (inx, value2) {
  831 + if (correctResponse[inx].Answer.indexOf('|') != -1) {
  832 + var multipleanswer = correctResponse[inx].Answer.split('|');
  833 + option = multipleanswer[0];
  834 + }
  835 + else
  836 + option = correctResponse[inx].Answer;
  837 +
  838 + var options = new jinqJs()
  839 + .from(Options)
  840 + .where('OptionNumber == ' + option)
  841 + .select();
  842 + var optionText = options[0].OptionTitle;
  843 +
831 844 $scope.OptionName = "";
832 845 $.each(Options, function (inx1, value3) {
833   - if (Options[inx1].OptionTitle == $('#blockans-' + correctResponse[inx].OptionBox).text()) {
834   - $scope.OptionName = Options[inx1].OptionNumber;
  846 +
  847 +
  848 + if (optionText == $('#blockans-' + correctResponse[inx].OptionBox).text()) {
  849 + $scope.OptionName = option;
835 850 }
  851 + //if (Options[inx1].OptionTitle == $('#blockans-' + correctResponse[inx].OptionBox).text()) {
  852 + // $scope.OptionName = Options[inx1].OptionNumber;
  853 + //}
836 854 });
837   - if (correctResponse[inx].Answer == $scope.OptionName) {
  855 + //if (correctResponse[inx].Answer == $scope.OptionName) {
  856 + // blReviewAttempt = true;
  857 + //}
  858 + //else {
  859 + // blReviewAttempt = false;
  860 + // $('#blockans-' + correctResponse[inx].OptionBox).css("background", "#ff4e00");
  861 + //}
  862 +
  863 + if (option == $scope.OptionName) {
838 864 blReviewAttempt = true;
839 865 }
840 866 else {
841 867 blReviewAttempt = false;
842 868 $('#blockans-' + correctResponse[inx].OptionBox).css("background", "#ff4e00");
843 869 }
844   -
845   -
846 870 });
847 871 }
848 872 });
... ... @@ -1118,7 +1142,9 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter,
1118 1142 .where('OptionNumber == ' + option)
1119 1143 .select();
1120 1144 var optionText = options[0].OptionTitle;
1121   - $scope.correctResponse += blankBox + ' ' + option + ',';
  1145 + //$scope.correctResponse += blankBox + ' ' + option + ',';
  1146 + $scope.correctResponse += blankBox + ' ' + cr[0].correctResponse[i].Answer + ',';
  1147 +
1122 1148 $scope.correctResponseForSavingDatabase += parseInt(blankBox.replace('T', '')) - 1 + ':' + optionText + ',';
1123 1149 }
1124 1150  
... ... @@ -1148,8 +1174,21 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter,
1148 1174  
1149 1175 var userOptedAnswer = value.BlankBoxName + ' ' + value.OptionName;
1150 1176 for (var i = 0; i < $scope.correctResonseKeyValue.length; i++) {
1151   - if (userOptedAnswer == $scope.correctResonseKeyValue[i]) {
1152   - $scope.Score += 1;
  1177 + if ($scope.correctResonseKeyValue[i].indexOf('|') != -1) {
  1178 + var splitedOption = $scope.correctResonseKeyValue[i].split(' ');
  1179 + var multipleanswer = splitedOption[1].split('|');
  1180 + var opt1 = splitedOption[0]+' '+ multipleanswer[0];
  1181 + var opt2 = splitedOption[0] + ' ' + multipleanswer[1];
  1182 +
  1183 + if (userOptedAnswer == opt1 || userOptedAnswer == opt2) {
  1184 + $scope.Score += 1;
  1185 + }
  1186 + }
  1187 + else {
  1188 +
  1189 + if (userOptedAnswer == $scope.correctResonseKeyValue[i]) {
  1190 + $scope.Score += 1;
  1191 + }
1153 1192 }
1154 1193  
1155 1194 }
... ...