Commit 5efb41e2d7cd421996f0d769bab76e4dc48feea2

Authored by Nikita Kulshreshtha
2 parents 122e15b3 207f0331

Report is complete. On;y nned to do sorting in showing question numbers.

currently questions are not shown in ascending order.
Email is pending
400-SOURCECODE/AIAHTML5.API/Web.config
... ... @@ -69,15 +69,15 @@
69 69 <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
70 70 <dependentAssembly>
71 71 <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
72   - <bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="6.0.0.0" />
  72 + <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="4.5.0.0" />
73 73 </dependentAssembly>
74 74 <dependentAssembly>
75 75 <assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
76   - <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
  76 + <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.0.0.0" />
77 77 </dependentAssembly>
78 78 <dependentAssembly>
79 79 <assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" />
80   - <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
  80 + <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.0.0.0" />
81 81 </dependentAssembly>
82 82 <dependentAssembly>
83 83 <assemblyIdentity name="System.Runtime.InteropServices.RuntimeInformation" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
... ...
400-SOURCECODE/AIAHTML5.Web/app/controllers/LabExercController.js
... ... @@ -109,6 +109,7 @@ function ($scope, $rootScope, pages, log, $http,$timeout, DataService, $filter,
109 109 if (labResult != undefined && labResult.lastQuestion>0 && labResult != AIAConstants.SAVED_LAB_EXERCISE_NOT_FOUND) {
110 110 $scope.SavedLabExercise = labResult;
111 111 $scope.quiznumber = $scope.SavedLabExercise.lastQuestion;
  112 + $scope.initialQuestioNo = $scope.SavedLabExercise.lastQuestion;
112 113 $scope.GetQuizByTopic();
113 114 }
114 115 else {
... ... @@ -312,25 +313,55 @@ function ($scope, $rootScope, pages, log, $http,$timeout, DataService, $filter,
312 313  
313 314  
314 315 $scope.SubmitAttempt = function () {
315   -
  316 +
316 317 $scope.CreateLabExerciseDataToSave();
317 318  
318 319 $("#submitResultHtml").css("display", "block");
319 320 $("#questionHtml").css("display", "none");
320 321 console.log($scope.usersCorrectQuestData);
321 322 $("#resultLabData").empty();
322   - for (var i = 0; i <= $scope.usersCorrectQuestData.length - 1; i++) {
323   - if ($scope.usersCorrectQuestData[i].CorrectStatus == "Correct") {
324   - 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>");
325   - $compile(labExerciseHtml)($scope);
  323 +
  324 + $scope.usersCorrectQuestData.sort(function (obj1, obj2) {
  325 + // Ascending: first age less than the previous
  326 + return obj1.QuestionNo - obj2.QuestionNo;
  327 + });
  328 +
  329 +
  330 + for (var j = $scope.TotalNumberofQuiz; j >= 1; j--) {
  331 + for (var i = 0; i <= $scope.usersCorrectQuestData.length - 1; i++) {
  332 + if (j == $scope.usersCorrectQuestData[i].QuestionNo)
  333 + {
  334 + if ($scope.usersCorrectQuestData[i].CorrectStatus == "Correct") {
  335 + 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>");
  336 + $compile(labExerciseHtml)($scope);
  337 + }
  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>");
  340 + $compile(labExerciseHtml)($scope);
  341 + }
  342 + break;
  343 + }
  344 + else
  345 + {
  346 + var labExerciseHtml_1 = $("#resultLabData").prepend("<tr><td>" + j + "</td><td>&nbsp;</td><td>Incorrect</td><td><button ng-click='reviewAttemptAnswer($event);' id=" + j + " class='btn btn-danger btn-sm'><i class='fa fa-times'></i> Review</button></td></tr>");
  347 + $compile(labExerciseHtml_1)($scope);
  348 + break;
  349 + }
  350 + }
  351 + }
  352 +
  353 +
  354 + $scope.inCorrectAnswer = 0;
  355 + $scope.CorrectAnswer = 0;
  356 + $("#resultLabData tr td:nth-child(3)").each(function () {
  357 + if ($(this).text() == "Incorrect") {
  358 + $scope.inCorrectAnswer = $scope.inCorrectAnswer + 1;
326 359 }
327 360 else
328 361 {
329   - 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>");
330   - $compile(labExerciseHtml)($scope);
  362 + $scope.CorrectAnswer = $scope.CorrectAnswer + 1;
331 363 }
332   -
333   - }
  364 + });
334 365 }
335 366  
336 367  
... ... @@ -585,6 +616,7 @@ function ($scope, $rootScope, pages, log, $http,$timeout, DataService, $filter,
585 616 //LabExerciseService.saveLabExerciseAttempt("superadmin", $scope.LabExerciseAttemptedData)
586 617 $scope.labExerciseAttempt = [];
587 618 $scope.labExerciseAttempt.push({ 'LabExerciseUserData': $scope.LabExerciseUserData, 'userId': $scope.userId, 'labExerciseIdentifier': $scope.labExerciseIdentifier, 'LastQuestion': $scope.LastQuestion, 'TotalQuestions': $scope.TotalQuestions });
  619 + $scope.initialQuestioNo = $scope.LastQuestion;
588 620 LabExerciseService.saveLabExerciseAttempt($scope.labExerciseAttempt)
589 621 .then(
590 622 function (result) {
... ... @@ -611,7 +643,7 @@ function ($scope, $rootScope, pages, log, $http,$timeout, DataService, $filter,
611 643  
612 644 $scope.usersCorrectQuestData = [];
613 645 $scope.CreateLabExerciseDataToSave = function () {
614   -
  646 +
615 647 $scope.LabExerciseAttemptedData = [];
616 648 $scope.lb = [];
617 649 //get user answers
... ... @@ -645,36 +677,8 @@ function ($scope, $rootScope, pages, log, $http,$timeout, DataService, $filter,
645 677 title: $scope.activityTitle
646 678  
647 679 }
648   - console.log($scope.LabExerciseAttemptedData);
649 680  
650   - if ($scope.MaxScore == $scope.Score)
651   - {
652   - $scope.usersCorrectQuestData.push({
653   - MaxScore: $scope.MaxScore,
654   - UserAnswer: $scope.commaSeperatedUserAnswers,
655   - QuestionNo: $scope.quiznumber,
656   - CorrectAnswer: JSON.stringify($scope.correctResponseForSavingDatabase),
657   - DragItems: $scope.DragItems,
658   - Score: $scope.Score,
659   - title: $scope.activityTitle,
660   - CorrectStatus: 'Correct'
661   -
662   - });
663   - }
664   - else
665   - {
666   - $scope.usersCorrectQuestData.push({
667   - MaxScore: $scope.MaxScore,
668   - UserAnswer: $scope.commaSeperatedUserAnswers,
669   - QuestionNo: $scope.quiznumber,
670   - CorrectAnswer: JSON.stringify($scope.correctResponseForSavingDatabase),
671   - DragItems: $scope.DragItems,
672   - Score: $scope.Score,
673   - title: $scope.activityTitle,
674   - CorrectStatus: 'Incorrect'
675   -
676   - });
677   - }
  681 +
678 682  
679 683 var thisQuestiondataInLabExerciseUserData = new jinqJs()
680 684 .from($scope.LabExerciseUserData)
... ... @@ -698,7 +702,71 @@ function ($scope, $rootScope, pages, log, $http,$timeout, DataService, $filter,
698 702 })
699 703 }
700 704 else
701   - $scope.LabExerciseUserData.push($scope.LabExerciseAttemptedData);
  705 + $scope.LabExerciseUserData.push($scope.LabExerciseAttemptedData);
  706 +
  707 + $scope.usersCorrectQuestData = [];
  708 + //alert($scope.LabExerciseUserData);
  709 + if ($scope.LabExerciseUserData.length > 0) {
  710 +
  711 + for(var i=0;i<=$scope.LabExerciseUserData.length-1;i++)
  712 + {
  713 +
  714 + if ($scope.LabExerciseUserData[i].MaxScore == $scope.LabExerciseUserData[i].Score) {
  715 + $scope.usersCorrectQuestData.push({
  716 + MaxScore: $scope.LabExerciseUserData[i].MaxScore,
  717 + UserAnswer: $scope.LabExerciseUserData[i].UserAnswer,
  718 + QuestionNo: $scope.LabExerciseUserData[i].QuestionNo,
  719 + CorrectAnswer: JSON.stringify($scope.LabExerciseUserData[i].CorrectAnswer),
  720 + DragItems: $scope.LabExerciseUserData[i].DragItems,
  721 + Score: $scope.LabExerciseUserData[i].Score,
  722 + title: $scope.LabExerciseUserData[i].title,
  723 + CorrectStatus: 'Correct'
  724 + });
  725 + }
  726 + else {
  727 + $scope.usersCorrectQuestData.push({
  728 + MaxScore: $scope.LabExerciseUserData[i].MaxScore,
  729 + UserAnswer: $scope.LabExerciseUserData[i].UserAnswer,
  730 + QuestionNo: $scope.LabExerciseUserData[i].QuestionNo,
  731 + CorrectAnswer: JSON.stringify($scope.LabExerciseUserData[i].CorrectAnswer),
  732 + DragItems: $scope.LabExerciseUserData[i].DragItems,
  733 + Score: $scope.LabExerciseUserData[i].Score,
  734 + title: $scope.LabExerciseUserData[i].title,
  735 + CorrectStatus: 'Incorrect'
  736 + });
  737 + }
  738 + }
  739 +
  740 + }
  741 + else {
  742 + if ($scope.MaxScore == $scope.Score) {
  743 + $scope.usersCorrectQuestData.push({
  744 + MaxScore: $scope.MaxScore,
  745 + UserAnswer: $scope.commaSeperatedUserAnswers,
  746 + QuestionNo: $scope.quiznumber,
  747 + CorrectAnswer: JSON.stringify($scope.correctResponseForSavingDatabase),
  748 + DragItems: $scope.DragItems,
  749 + Score: $scope.Score,
  750 + title: $scope.activityTitle,
  751 + CorrectStatus: 'Correct'
  752 + });
  753 + }
  754 + else {
  755 + $scope.usersCorrectQuestData.push({
  756 + MaxScore: $scope.MaxScore,
  757 + UserAnswer: $scope.commaSeperatedUserAnswers,
  758 + QuestionNo: $scope.quiznumber,
  759 + CorrectAnswer: JSON.stringify($scope.correctResponseForSavingDatabase),
  760 + DragItems: $scope.DragItems,
  761 + Score: $scope.Score,
  762 + title: $scope.activityTitle,
  763 + CorrectStatus: 'Incorrect'
  764 + });
  765 + }
  766 + }
  767 +
  768 + // console.log($scope.usersCorrectQuestData);
  769 + // console.log($scope.LabExerciseUserData);
702 770 }
703 771 $scope.reviewAttemptAnswer = function (evt) {
704 772 $scope.isReviewBtnSelected = true;
... ... @@ -710,10 +778,10 @@ function ($scope, $rootScope, pages, log, $http,$timeout, DataService, $filter,
710 778 $("#reportBtn").css("display", "block");
711 779 $("#quizSubmitBtn").css("display", "none");
712 780 $scope.quiznumber = evt.target.id;
713   - $scope.CreateLabExerciseDataToSave();
  781 + // $scope.CreateLabExerciseDataToSave();
714 782 $scope.dragableId = "";
715   - // $scope.resetQuiz();
716   - $scope.GetQuizByTopic();
  783 + $scope.resetQuiz();
  784 + // $scope.GetQuizByTopic();
717 785 //$scope.ShowHideDiv();
718 786 }
719 787  
... ... @@ -836,7 +904,6 @@ function ($scope, $rootScope, pages, log, $http,$timeout, DataService, $filter,
836 904 $scope.ShowSavedLabExercise = function () {
837 905  
838 906 //from database
839   -
840 907 var lastQuestion = $scope.quiznumber;
841 908 var lastQuestionDetails;
842 909 var lastQuestionAnswers;
... ...
400-SOURCECODE/AIAHTML5.Web/app/views/LabExerc/lab-exercises-detail.html
... ... @@ -102,9 +102,9 @@
102 102 </thead>
103 103 <tbody>
104 104 <tr class="text-center">
105   - <td>18</td>
106   - <td>0</td>
107   - <td>18</td>
  105 + <td>{{TotalNumberofQuiz}}</td>
  106 + <td>{{CorrectAnswer}}</td>
  107 + <td>{{inCorrectAnswer}}</td>
108 108 </tr>
109 109 </tbody>
110 110 </table>
... ...