Commit 60c29dfa55691a870604ba9928a1b153dac44c29

Authored by unknown
1 parent ede6803d

implemented lab exercise bugs

400-SOURCECODE/AIAHTML5.Web/app/controllers/LabExercController.js
@@ -15,7 +15,7 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, @@ -15,7 +15,7 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter,
15 $scope.LabExerciseUserData = []; 15 $scope.LabExerciseUserData = [];
16 $scope.LabExercise = []; 16 $scope.LabExercise = [];
17 $scope.dragableId = ""; 17 $scope.dragableId = "";
18 - $scope.UserAttempt = []; 18 +
19 $scope.blReviewAttempt = false; 19 $scope.blReviewAttempt = false;
20 $scope.isResetClicked = false; 20 $scope.isResetClicked = false;
21 $scope.$on('$viewContentLoaded', function (event) { 21 $scope.$on('$viewContentLoaded', function (event) {
@@ -307,7 +307,7 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, @@ -307,7 +307,7 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter,
307 $scope.CreateLabExerciseDataToSave(); 307 $scope.CreateLabExerciseDataToSave();
308 } 308 }
309 $scope.dragableId = ""; 309 $scope.dragableId = "";
310 - $scope.UserAttempt = []; 310 + // $scope.UserAttempt = [];
311 if ($scope.quiznumber == 1) 311 if ($scope.quiznumber == 1)
312 return; 312 return;
313 else 313 else
@@ -370,6 +370,42 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, @@ -370,6 +370,42 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter,
370 $("#resultLabData").empty(); 370 $("#resultLabData").empty();
371 var sortedQuestionHtml = ''; 371 var sortedQuestionHtml = '';
372 372
  373 +
  374 +
  375 +
  376 +
  377 + // console.log($scope.SavedLabExercise);
  378 +
  379 + $scope.usersCorrectQuestDataArray = [];
  380 +
  381 + for (var j = 0; j <= $scope.usersCorrectQuestData.length - 1; j++) {
  382 +
  383 + for (var i = 0; i <= $scope.SavedLabExercise.labExercise.length - 1; i++) {
  384 +
  385 + if ($scope.SavedLabExercise.labExercise[i].QuestionNo == $scope.usersCorrectQuestData[j].QuestionNo) {
  386 + // alert($scope.SavedLabExercise.labExercise[i].QuestionNo + " " + $scope.usersCorrectQuestData[j].QuestionNo);
  387 + }
  388 + else {
  389 +
  390 + if ($scope.SavedLabExercise.labExercise[i].MaxScore == $scope.SavedLabExercise.labExercise[i].Score) {
  391 + $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": " " });
  392 +
  393 + }
  394 + else {
  395 + $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": " " });
  396 + }
  397 + }
  398 + }
  399 + }
  400 + console.log($scope.usersCorrectQuestDataArray);
  401 + for (var i = 0; i <= $scope.usersCorrectQuestDataArray.length - 1; i++) {
  402 + $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": " " });
  403 + }
  404 +
  405 + //console.log($scope.usersCorrectQuestData);
  406 +
  407 +
  408 +
373 for (var j = $scope.TotalNumberofQuiz; j >= 1; j--) { 409 for (var j = $scope.TotalNumberofQuiz; j >= 1; j--) {
374 for (var i = 0; i <= $scope.usersCorrectQuestData.length - 1; i++) { 410 for (var i = 0; i <= $scope.usersCorrectQuestData.length - 1; i++) {
375 if (j == $scope.usersCorrectQuestData[i].QuestionNo) { 411 if (j == $scope.usersCorrectQuestData[i].QuestionNo) {
@@ -429,7 +465,10 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, @@ -429,7 +465,10 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter,
429 if ($(this).text().length == 1) { 465 if ($(this).text().length == 1) {
430 var a = parseInt($(this).prev().text()) - 1; 466 var a = parseInt($(this).prev().text()) - 1;
431 $(this).text($scope.labExerciseModuleData[0].Questions[a].activityTitle); 467 $(this).text($scope.labExerciseModuleData[0].Questions[a].activityTitle);
432 - $(this).next().text("Not Attempted"); 468 + if ($(this).next().text() == "Correct") { $(this).next().text("Correct"); }
  469 + else {
  470 + $(this).next().text("Incorrect");
  471 + }
433 } 472 }
434 }); 473 });
435 } 474 }
@@ -883,6 +922,14 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, @@ -883,6 +922,14 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter,
883 $scope.usersCorrectQuestData = []; 922 $scope.usersCorrectQuestData = [];
884 $scope.CreateLabExerciseDataToSave = function () { 923 $scope.CreateLabExerciseDataToSave = function () {
885 924
  925 + if ($scope.UserAttempt.length == 0) {
  926 + $("#imgdiv").find("div").each(function () {
  927 + if ($(this).attr("id").split("-")[0] == "blockans") {
  928 + $scope.UserAttempt.push({ "BlankBoxName": $(this).attr("id").split("-")[1], "OptionName": $(this).attr("draggedattr").split("-")[1] });
  929 + }
  930 + });
  931 + }
  932 +
886 $scope.LabExerciseAttemptedData = []; 933 $scope.LabExerciseAttemptedData = [];
887 $scope.lb = []; 934 $scope.lb = [];
888 //get user answers 935 //get user answers