Commit cee3de3979fd0fd61b658be241d14714ed4015ac

Authored by Nikita Kulshreshtha
1 parent 5efb41e2

questions are in ascending order

400-SOURCECODE/AIAHTML5.Web/app/controllers/LabExercController.js
@@ -311,7 +311,7 @@ function ($scope, $rootScope, pages, log, $http,$timeout, DataService, $filter, @@ -311,7 +311,7 @@ function ($scope, $rootScope, pages, log, $http,$timeout, DataService, $filter,
311 //} 311 //}
312 } 312 }
313 313
314 - 314 +
315 $scope.SubmitAttempt = function () { 315 $scope.SubmitAttempt = function () {
316 316
317 $scope.CreateLabExerciseDataToSave(); 317 $scope.CreateLabExerciseDataToSave();
@@ -320,7 +320,7 @@ function ($scope, $rootScope, pages, log, $http,$timeout, DataService, $filter, @@ -320,7 +320,7 @@ function ($scope, $rootScope, pages, log, $http,$timeout, DataService, $filter,
320 $("#questionHtml").css("display", "none"); 320 $("#questionHtml").css("display", "none");
321 console.log($scope.usersCorrectQuestData); 321 console.log($scope.usersCorrectQuestData);
322 $("#resultLabData").empty(); 322 $("#resultLabData").empty();
323 - 323 + var sortedQuestionHtml = '';
324 $scope.usersCorrectQuestData.sort(function (obj1, obj2) { 324 $scope.usersCorrectQuestData.sort(function (obj1, obj2) {
325 // Ascending: first age less than the previous 325 // Ascending: first age less than the previous
326 return obj1.QuestionNo - obj2.QuestionNo; 326 return obj1.QuestionNo - obj2.QuestionNo;
@@ -336,7 +336,7 @@ function ($scope, $rootScope, pages, log, $http,$timeout, DataService, $filter, @@ -336,7 +336,7 @@ function ($scope, $rootScope, pages, log, $http,$timeout, DataService, $filter,
336 $compile(labExerciseHtml)($scope); 336 $compile(labExerciseHtml)($scope);
337 } 337 }
338 else { 338 else {
339 - 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>"); 339 + 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>");
340 $compile(labExerciseHtml)($scope); 340 $compile(labExerciseHtml)($scope);
341 } 341 }
342 break; 342 break;
@@ -349,8 +349,25 @@ function ($scope, $rootScope, pages, log, $http,$timeout, DataService, $filter, @@ -349,8 +349,25 @@ function ($scope, $rootScope, pages, log, $http,$timeout, DataService, $filter,
349 } 349 }
350 } 350 }
351 } 351 }
  352 +
  353 + for (var j = 1;j <= $scope.TotalNumberofQuiz;j++) {
  354 + $("#resultLabData tr td:nth-child(1)").each(function () {
  355 + if (j == $(this).text()) {
  356 + $q = $(this).parent();
  357 + if ($q.find("td:nth-child(3)").text() == "Correct") {
  358 + 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>';
  359 + }
  360 + else
  361 + {
  362 + 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>';
  363 + }
  364 + }
  365 + });
352 366
353 - 367 + }
  368 + $("#resultLabData").empty();
  369 + var sortedCompileHtml = $("#resultLabData").append(sortedQuestionHtml);
  370 + $compile(sortedCompileHtml)($scope);
354 $scope.inCorrectAnswer = 0; 371 $scope.inCorrectAnswer = 0;
355 $scope.CorrectAnswer = 0; 372 $scope.CorrectAnswer = 0;
356 $("#resultLabData tr td:nth-child(3)").each(function () { 373 $("#resultLabData tr td:nth-child(3)").each(function () {