Commit 91cead3b08e5b4185bfdeb4d215ecfe6d8cbdf47
Merge branch 'reportIssue_1' of http://gitlab.ebix.com/ADAM/AIAHTML5 into getModestyBasedOnLiEdi
Showing
1 changed file
with
61 additions
and
69 deletions
400-SOURCECODE/AIAHTML5.Web/app/controllers/LabExercController.js
@@ -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 |
@@ -328,93 +328,82 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, | @@ -328,93 +328,82 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, | ||
328 | $scope.ShowHideDiv(); | 328 | $scope.ShowHideDiv(); |
329 | 329 | ||
330 | 330 | ||
331 | - | ||
332 | - //for (var i = 0; i <= $rootScope.selectedDivArray.length - 1; i++) { | ||
333 | - // if ($scope.quiznumber == $rootScope.selectedDivArray[i].questionNo) { | ||
334 | - // alert($rootScope.selectedDivArray[i].draggedText); | ||
335 | - // document.getElementById($rootScope.selectedDivArray[i].droppedID).innerHTML = $rootScope.selectedDivArray[i].draggedText; | ||
336 | - // // $('#'+$rootScope.selectedDivArray[i].droppedID).html($rootScope.selectedDivArray[i].draggedText); | ||
337 | - // document.getElementById($rootScope.selectedDivArray[i].droppedID).style.display = "none"; | ||
338 | - // // $('#'+$rootScope.selectedDivArray[i].draggedID).css("display","none!important"); | ||
339 | - // } | ||
340 | - | ||
341 | - //} | ||
342 | - | ||
343 | - | ||
344 | - //$timeout(function () { | ||
345 | - // if ($scope.Title == "Complete the statements below.") { | ||
346 | - // $("#imgdiv").css("position", "static"); | ||
347 | - // $("#imgdiv").find("div").each(function () { | ||
348 | - // var answerDiv = $(this).attr("id").split("-"); | ||
349 | - // if (answerDiv[0] == "blockans") { | ||
350 | - // var concatID = answerDiv[0] + "-" + answerDiv[1]; | ||
351 | - // $("#" + concatID).css("width", "auto"); | ||
352 | - // } | ||
353 | - // }); | ||
354 | - // } | ||
355 | - // else { | ||
356 | - // $("#imgdiv").css("position", "relative"); | ||
357 | - // } | ||
358 | - //}, 350); | ||
359 | - | ||
360 | } | 331 | } |
361 | 332 | ||
362 | 333 | ||
363 | $scope.SubmitAttempt = function () { | 334 | $scope.SubmitAttempt = function () { |
364 | - | 335 | + |
365 | $scope.CreateLabExerciseDataToSave(); | 336 | $scope.CreateLabExerciseDataToSave(); |
366 | 337 | ||
367 | $("#submitResultHtml").css("display", "block"); | 338 | $("#submitResultHtml").css("display", "block"); |
368 | $("#questionHtml").css("display", "none"); | 339 | $("#questionHtml").css("display", "none"); |
369 | - console.log($scope.usersCorrectQuestData); | 340 | + // console.log($scope.usersCorrectQuestData); |
370 | $("#resultLabData").empty(); | 341 | $("#resultLabData").empty(); |
371 | var sortedQuestionHtml = ''; | 342 | var sortedQuestionHtml = ''; |
372 | 343 | ||
344 | + // start code for generating report | ||
373 | 345 | ||
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 { | 346 | + $scope.LabExerciseUserDataArray1 = []; |
347 | + $scope.LabExerciseUserDataArray2 = []; | ||
348 | + $scope.LabExerciseUserDataArray1 = $scope.LabExerciseUserData; | ||
349 | + // console.log($scope.LabExerciseUserData); | ||
350 | + // console.log($scope.LabExerciseUserDataArray1); | ||
351 | + | ||
352 | + for (var i = 0; i <= $scope.SavedLabExercise.labExercise.length - 1; i++) { | ||
389 | 353 | ||
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": " " }); | 354 | + if ($scope.SavedLabExercise.labExercise[i].QuestionNo < $scope.LabExerciseUserDataArray1[0].QuestionNo) { |
392 | 355 | ||
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 | - } | 356 | + $scope.LabExerciseUserDataArray1.push({ |
357 | + "DragItems": $scope.SavedLabExercise.labExercise[i].DragItems, | ||
358 | + "MaxScore": $scope.SavedLabExercise.labExercise[i].MaxScore, | ||
359 | + "QuestionNo": $scope.SavedLabExercise.labExercise[i].QuestionNo, | ||
360 | + "Score": $scope.SavedLabExercise.labExercise[i].Score, | ||
361 | + "UserAnswer": $scope.SavedLabExercise.labExercise[i].UserAnswers, | ||
362 | + "title": $scope.SavedLabExercise.labExercise[i].title | ||
363 | + }) | ||
364 | + | ||
398 | } | 365 | } |
399 | } | 366 | } |
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": " " }); | 367 | + |
368 | + for (var i = 0; i <= $scope.LabExerciseUserDataArray1.length - 1; i++) { | ||
369 | + | ||
370 | + if ($scope.LabExerciseUserDataArray1[i].MaxScore == $scope.LabExerciseUserDataArray1[i].Score) | ||
371 | + { | ||
372 | + $scope.LabExerciseUserDataArray2.push({ | ||
373 | + "CorrectStatus": "Correct", | ||
374 | + "DragItems": $scope.LabExerciseUserDataArray1[i].DragItems, | ||
375 | + "MaxScore": $scope.LabExerciseUserDataArray1[i].MaxScore, | ||
376 | + "QuestionNo": $scope.LabExerciseUserDataArray1[i].QuestionNo, | ||
377 | + "Score": $scope.LabExerciseUserDataArray1[i].Score, | ||
378 | + // "UserAnswer": $scope.LabExerciseUserDataArray1[i].UserAnswers, | ||
379 | + // "title": $scope.LabExerciseUserDataArray1[i].title | ||
380 | + }) | ||
381 | + } | ||
382 | + else { | ||
383 | + $scope.LabExerciseUserDataArray2.push({ | ||
384 | + "CorrectStatus": "Incorrect", | ||
385 | + "DragItems": $scope.LabExerciseUserDataArray1[i].DragItems, | ||
386 | + "MaxScore": $scope.LabExerciseUserDataArray1[i].MaxScore, | ||
387 | + "QuestionNo": $scope.LabExerciseUserDataArray1[i].QuestionNo, | ||
388 | + "Score": $scope.LabExerciseUserDataArray1[i].Score, | ||
389 | + // "UserAnswer": $scope.LabExerciseUserDataArray1[i].UserAnswers, | ||
390 | + // "title": $scope.LabExerciseUserDataArray1[i].title | ||
391 | + }) | ||
392 | + } | ||
403 | } | 393 | } |
404 | 394 | ||
405 | - //console.log($scope.usersCorrectQuestData); | ||
406 | - | 395 | + // end code for generating report |
407 | 396 | ||
408 | 397 | ||
409 | for (var j = $scope.TotalNumberofQuiz; j >= 1; j--) { | 398 | for (var j = $scope.TotalNumberofQuiz; j >= 1; j--) { |
410 | - for (var i = 0; i <= $scope.usersCorrectQuestData.length - 1; i++) { | ||
411 | - if (j == $scope.usersCorrectQuestData[i].QuestionNo) { | ||
412 | - if ($scope.usersCorrectQuestData[i].CorrectStatus == "Correct") { | ||
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>"); | 399 | + for (var i = 0; i <= $scope.LabExerciseUserDataArray2.length - 1; i++) { |
400 | + if (j == $scope.LabExerciseUserDataArray2[i].QuestionNo) { | ||
401 | + if ($scope.LabExerciseUserDataArray2[i].CorrectStatus == "Correct") { | ||
402 | + var labExerciseHtml = $("#resultLabData").append("<tr><td>" + $scope.LabExerciseUserDataArray2[i].QuestionNo + "</td><td> </td><td>" + $scope.LabExerciseUserDataArray2[i].CorrectStatus + "</td><td><button ng-click='reviewAttemptAnswer($event);' id=" + $scope.LabExerciseUserDataArray2[i].QuestionNo + " class='btn btn-sm' style='background-color:#007ab3;border-color:#007ab3;color:#ffffff;'> Review</button></td></tr>"); | ||
414 | $compile(labExerciseHtml)($scope); | 403 | $compile(labExerciseHtml)($scope); |
415 | } | 404 | } |
416 | else { | 405 | else { |
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>"); | 406 | + var labExerciseHtml = $("#resultLabData").append("<tr><td>" + $scope.LabExerciseUserDataArray2[i].QuestionNo + "</td><td> </td><td>" + $scope.LabExerciseUserDataArray2[i].CorrectStatus + "</td><td><button ng-click='reviewAttemptAnswer($event);' id=" + $scope.LabExerciseUserDataArray2[i].QuestionNo + " class='btn btn-sm' style='background-color:#d9534f;border-color:#d9534f;color:#ffffff;'> Review</button></td></tr>"); |
418 | $compile(labExerciseHtml)($scope); | 407 | $compile(labExerciseHtml)($scope); |
419 | } | 408 | } |
420 | $scope.isValueExist = true; | 409 | $scope.isValueExist = true; |
@@ -459,7 +448,7 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, | @@ -459,7 +448,7 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, | ||
459 | } | 448 | } |
460 | }); | 449 | }); |
461 | 450 | ||
462 | - $scope.scoreResult = (parseInt($scope.CorrectAnswer) / parseInt($scope.inCorrectAnswer)) * 100; | 451 | + $scope.scoreResult = (parseInt($scope.CorrectAnswer) / parseInt($scope.TotalNumberofQuiz)) * 100; |
463 | $scope.scoreResult = Math.round($scope.scoreResult); | 452 | $scope.scoreResult = Math.round($scope.scoreResult); |
464 | $("#resultLabData tr td:nth-child(2)").each(function (key, value) { | 453 | $("#resultLabData tr td:nth-child(2)").each(function (key, value) { |
465 | if ($(this).text().length == 1) { | 454 | if ($(this).text().length == 1) { |
@@ -494,7 +483,7 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, | @@ -494,7 +483,7 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, | ||
494 | $scope.dragableId = $(this).attr("Id"); | 483 | $scope.dragableId = $(this).attr("Id"); |
495 | $scope.a = $scope.dragableId; | 484 | $scope.a = $scope.dragableId; |
496 | 485 | ||
497 | - console.log($scope.dragableId); | 486 | + |
498 | $scope.dragableText = $("#" + $scope.dragableId).text(); | 487 | $scope.dragableText = $("#" + $scope.dragableId).text(); |
499 | 488 | ||
500 | if ($scope.dragableId.split('-')[0] != 'block') { | 489 | if ($scope.dragableId.split('-')[0] != 'block') { |
@@ -557,7 +546,7 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, | @@ -557,7 +546,7 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, | ||
557 | 546 | ||
558 | $scope.item = $('#' + $scope.dragableId).html(); | 547 | $scope.item = $('#' + $scope.dragableId).html(); |
559 | var rindex = $scope.DraggedList.indexOf($scope.item); | 548 | var rindex = $scope.DraggedList.indexOf($scope.item); |
560 | - console.log($scope.DraggedList); | 549 | + |
561 | var labExerciseModulePath = '~/../content/data/json/le/' + keywords.labexercise + '.json'; | 550 | var labExerciseModulePath = '~/../content/data/json/le/' + keywords.labexercise + '.json'; |
562 | DataService.getAnotherJson(labExerciseModulePath).then( | 551 | DataService.getAnotherJson(labExerciseModulePath).then( |
563 | function (result) { | 552 | function (result) { |
@@ -921,7 +910,7 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, | @@ -921,7 +910,7 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, | ||
921 | 910 | ||
922 | $scope.usersCorrectQuestData = []; | 911 | $scope.usersCorrectQuestData = []; |
923 | $scope.CreateLabExerciseDataToSave = function () { | 912 | $scope.CreateLabExerciseDataToSave = function () { |
924 | - | 913 | + |
925 | if ($scope.UserAttempt.length == 0) { | 914 | if ($scope.UserAttempt.length == 0) { |
926 | $("#imgdiv").find("div").each(function () { | 915 | $("#imgdiv").find("div").each(function () { |
927 | if ($(this).attr("id").split("-")[0] == "blockans") { | 916 | if ($(this).attr("id").split("-")[0] == "blockans") { |
@@ -929,7 +918,10 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, | @@ -929,7 +918,10 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, | ||
929 | } | 918 | } |
930 | }); | 919 | }); |
931 | } | 920 | } |
932 | - | 921 | + |
922 | + // console.log($scope.SavedLabExercise); | ||
923 | + // console.log($scope.usersCorrectQuestData); | ||
924 | + // console.log($scope.LabExerciseUserData); | ||
933 | $scope.LabExerciseAttemptedData = []; | 925 | $scope.LabExerciseAttemptedData = []; |
934 | $scope.lb = []; | 926 | $scope.lb = []; |
935 | //get user answers | 927 | //get user answers |