Commit 05693000880715bd7b7e8b58a302b32526488904

Authored by unknown
1 parent bc58acbe

implemented lab exercise bug

400-SOURCECODE/AIAHTML5.Web/app/controllers/LabExercController.js
... ... @@ -307,7 +307,7 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter,
307 307 $scope.CreateLabExerciseDataToSave();
308 308 }
309 309 $scope.dragableId = "";
310   - // $scope.UserAttempt = [];
  310 + //$scope.UserAttempt = [];
311 311 if ($scope.quiznumber == 1)
312 312 return;
313 313 else
... ... @@ -328,35 +328,6 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter,
328 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  
... ... @@ -366,55 +337,73 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter,
366 337  
367 338 $("#submitResultHtml").css("display", "block");
368 339 $("#questionHtml").css("display", "none");
369   - console.log($scope.usersCorrectQuestData);
  340 + // console.log($scope.usersCorrectQuestData);
370 341 $("#resultLabData").empty();
371 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 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>&nbsp;</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 403 $compile(labExerciseHtml)($scope);
415 404 }
416 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>&nbsp;</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 407 $compile(labExerciseHtml)($scope);
419 408 }
420 409 $scope.isValueExist = true;
... ... @@ -494,7 +483,7 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter,
494 483 $scope.dragableId = $(this).attr("Id");
495 484 $scope.a = $scope.dragableId;
496 485  
497   - console.log($scope.dragableId);
  486 +
498 487 $scope.dragableText = $("#" + $scope.dragableId).text();
499 488  
500 489 if ($scope.dragableId.split('-')[0] != 'block') {
... ... @@ -557,7 +546,7 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter,
557 546  
558 547 $scope.item = $('#' + $scope.dragableId).html();
559 548 var rindex = $scope.DraggedList.indexOf($scope.item);
560   - console.log($scope.DraggedList);
  549 +
561 550 var labExerciseModulePath = '~/../content/data/json/le/' + keywords.labexercise + '.json';
562 551 DataService.getAnotherJson(labExerciseModulePath).then(
563 552 function (result) {
... ... @@ -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 925 $scope.LabExerciseAttemptedData = [];
934 926 $scope.lb = [];
935 927 //get user answers
... ...