Commit 4c9a3687a827dd2d2aad0e8dae70aca38e494780
1 parent
d5b789bd
mered LabExerciseCode
Showing
1 changed file
with
54 additions
and
7 deletions
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,15 +370,51 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, | @@ -370,15 +370,51 @@ 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) { |
376 | if ($scope.usersCorrectQuestData[i].CorrectStatus == "Correct") { | 412 | if ($scope.usersCorrectQuestData[i].CorrectStatus == "Correct") { |
377 | - var labExerciseHtml = $("#resultLabData").append("<tr><td>" + $scope.usersCorrectQuestData[i].QuestionNo + "</td><td>" + $scope.usersCorrectQuestData[i].title + "</td><td>" + $scope.usersCorrectQuestData[i].CorrectStatus + "</td><td><button ng-click='reviewAttemptAnswer($event);' id=" + $scope.usersCorrectQuestData[i].QuestionNo + " class='btn btn-sm' style='background-color:#007ab3;border-color:#007ab3;color:#ffffff;'><i class='fa fa-times'></i> Review</button></td></tr>"); | 413 | + var labExerciseHtml = $("#resultLabData").append("<tr><td>" + $scope.usersCorrectQuestData[i].QuestionNo + "</td><td>" + $scope.usersCorrectQuestData[i].title + "</td><td>" + $scope.usersCorrectQuestData[i].CorrectStatus + "</td><td><button ng-click='reviewAttemptAnswer($event);' id=" + $scope.usersCorrectQuestData[i].QuestionNo + " class='btn btn-sm' style='background-color:#007ab3;border-color:#007ab3;color:#ffffff;'> Review</button></td></tr>"); |
378 | $compile(labExerciseHtml)($scope); | 414 | $compile(labExerciseHtml)($scope); |
379 | } | 415 | } |
380 | else { | 416 | else { |
381 | - var labExerciseHtml = $("#resultLabData").append("<tr><td>" + $scope.usersCorrectQuestData[i].QuestionNo + "</td><td>" + $scope.usersCorrectQuestData[i].title + "</td><td>" + $scope.usersCorrectQuestData[i].CorrectStatus + "</td><td><button ng-click='reviewAttemptAnswer($event);' id=" + $scope.usersCorrectQuestData[i].QuestionNo + " class='btn btn-sm' style='background-color:#d9534f;border-color:#d9534f;color:#ffffff;'><i class='fa fa-times'></i> Review</button></td></tr>"); | 417 | + var labExerciseHtml = $("#resultLabData").append("<tr><td>" + $scope.usersCorrectQuestData[i].QuestionNo + "</td><td>" + $scope.usersCorrectQuestData[i].title + "</td><td>" + $scope.usersCorrectQuestData[i].CorrectStatus + "</td><td><button ng-click='reviewAttemptAnswer($event);' id=" + $scope.usersCorrectQuestData[i].QuestionNo + " class='btn btn-sm' style='background-color:#d9534f;border-color:#d9534f;color:#ffffff;'> Review</button></td></tr>"); |
382 | $compile(labExerciseHtml)($scope); | 418 | $compile(labExerciseHtml)($scope); |
383 | } | 419 | } |
384 | $scope.isValueExist = true; | 420 | $scope.isValueExist = true; |
@@ -399,10 +435,10 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, | @@ -399,10 +435,10 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, | ||
399 | if (j == $(this).text()) { | 435 | if (j == $(this).text()) { |
400 | $q = $(this).parent(); | 436 | $q = $(this).parent(); |
401 | if ($q.find("td:nth-child(3)").text() == "Correct") { | 437 | if ($q.find("td:nth-child(3)").text() == "Correct") { |
402 | - sortedQuestionHtml += '<tr><td>' + $q.find("td:nth-child(1)").text() + '</td><td>' + $q.find("td:nth-child(2)").text() + '</td><td>' + $q.find("td:nth-child(3)").text() + '</td><td><button ng-click="reviewAttemptAnswer($event);" id=' + $q.find("td:nth-child(1)").text() + ' class="btn btn-sm" style="background-color:#007ab3;border-color:#007ab3;color:#ffffff;"><i class="fa fa-times"></i> Review</button></td></tr>'; | 438 | + sortedQuestionHtml += '<tr><td>' + $q.find("td:nth-child(1)").text() + '</td><td>' + $q.find("td:nth-child(2)").text() + '</td><td>' + $q.find("td:nth-child(3)").text() + '</td><td><button ng-click="reviewAttemptAnswer($event);" id=' + $q.find("td:nth-child(1)").text() + ' class="btn btn-sm" style="background-color:#007ab3;border-color:#007ab3;color:#ffffff;"><i class="fa fa-check-circle"></i> Review</button></td></tr>'; |
403 | } | 439 | } |
404 | else { | 440 | else { |
405 | - sortedQuestionHtml += '<tr><td>' + $q.find("td:nth-child(1)").text() + '</td><td>' + $q.find("td:nth-child(2)").text() + '</td><td>' + $q.find("td:nth-child(3)").text() + '</td><td><button ng-click="reviewAttemptAnswer($event);" id=' + $q.find("td:nth-child(1)").text() + ' class="btn btn-sm" style="background-color:#d9534f;border-color:#d9534f;color:#ffffff;"><i class="fa fa-times"></i> Review</button></td></tr>'; | 441 | + sortedQuestionHtml += '<tr><td>' + $q.find("td:nth-child(1)").text() + '</td><td>' + $q.find("td:nth-child(2)").text() + '</td><td>' + $q.find("td:nth-child(3)").text() + '</td><td><button ng-click="reviewAttemptAnswer($event);" id=' + $q.find("td:nth-child(1)").text() + ' class="btn btn-sm" style="background-color:#d9534f;border-color:#d9534f;color:#ffffff;"><i class="fa fa-times-circle"></i> Review</button></td></tr>'; |
406 | } | 442 | } |
407 | } | 443 | } |
408 | }); | 444 | }); |
@@ -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 |