diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/LabExercController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/LabExercController.js index 43d3f9a..2f26f45 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/LabExercController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/LabExercController.js @@ -345,78 +345,66 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, $scope.SubmitAttempt = function () { - + $scope.CreateLabExerciseDataToSave(); $("#submitResultHtml").css("display", "block"); $("#questionHtml").css("display", "none"); - // console.log($scope.usersCorrectQuestData); + console.log($scope.usersCorrectQuestData); $("#resultLabData").empty(); var sortedQuestionHtml = ''; - // start code for generating report + if ($scope.SavedLabExercise != undefined && $scope.SavedLabExercise.labExercise.length > 0) { + for (var j = 0; j <= $scope.SavedLabExercise.labExercise.length - 1; j++) { + var boolValueEx = false; + for (var i = 0; i <= $scope.usersCorrectQuestData.length - 1; i++) { - $scope.LabExerciseUserDataArray1 = []; - $scope.LabExerciseUserDataArray2 = []; - $scope.LabExerciseUserDataArray1 = $scope.LabExerciseUserData; - // console.log($scope.LabExerciseUserData); - // console.log($scope.LabExerciseUserDataArray1); - - for (var i = 0; i <= $scope.SavedLabExercise.labExercise.length - 1; i++) { - - if ($scope.SavedLabExercise.labExercise[i].QuestionNo < $scope.LabExerciseUserDataArray1[0].QuestionNo) { + if ($scope.SavedLabExercise.labExercise[j].QuestionNo == $scope.usersCorrectQuestData[i].QuestionNo) { + boolValueEx = true; + break; + } + } - $scope.LabExerciseUserDataArray1.push({ - "DragItems": $scope.SavedLabExercise.labExercise[i].DragItems, - "MaxScore": $scope.SavedLabExercise.labExercise[i].MaxScore, - "QuestionNo": $scope.SavedLabExercise.labExercise[i].QuestionNo, - "Score": $scope.SavedLabExercise.labExercise[i].Score, - "UserAnswer": $scope.SavedLabExercise.labExercise[i].UserAnswers, - "title": $scope.SavedLabExercise.labExercise[i].title - }) - - } - } - - for (var i = 0; i <= $scope.LabExerciseUserDataArray1.length - 1; i++) { - - if ($scope.LabExerciseUserDataArray1[i].MaxScore == $scope.LabExerciseUserDataArray1[i].Score) - { - $scope.LabExerciseUserDataArray2.push({ - "CorrectStatus": "Correct", - "DragItems": $scope.LabExerciseUserDataArray1[i].DragItems, - "MaxScore": $scope.LabExerciseUserDataArray1[i].MaxScore, - "QuestionNo": $scope.LabExerciseUserDataArray1[i].QuestionNo, - "Score": $scope.LabExerciseUserDataArray1[i].Score, - // "UserAnswer": $scope.LabExerciseUserDataArray1[i].UserAnswers, - // "title": $scope.LabExerciseUserDataArray1[i].title - }) - } - else { - $scope.LabExerciseUserDataArray2.push({ - "CorrectStatus": "Incorrect", - "DragItems": $scope.LabExerciseUserDataArray1[i].DragItems, - "MaxScore": $scope.LabExerciseUserDataArray1[i].MaxScore, - "QuestionNo": $scope.LabExerciseUserDataArray1[i].QuestionNo, - "Score": $scope.LabExerciseUserDataArray1[i].Score, - // "UserAnswer": $scope.LabExerciseUserDataArray1[i].UserAnswers, - // "title": $scope.LabExerciseUserDataArray1[i].title - }) + if (boolValueEx == false) { + if ($scope.SavedLabExercise.labExercise[j].MaxScore == $scope.SavedLabExercise.labExercise[j].Score) { + $scope.usersCorrectQuestData.push({ + CorrectAnswers: $scope.SavedLabExercise.labExercise[j].CorrectAnswers, + DragItems: $scope.SavedLabExercise.labExercise[j].DragItems, + CorrectStatus: "Correct", + MaxScore: $scope.SavedLabExercise.labExercise[j].MaxScore, + QuestionNo: $scope.SavedLabExercise.labExercise[j].QuestionNo, + Score: $scope.SavedLabExercise.labExercise[j].Score, + UserAnswer: $scope.SavedLabExercise.labExercise[j].UserAnswers + }) + } + else { + $scope.usersCorrectQuestData.push({ + CorrectAnswers: $scope.SavedLabExercise.labExercise[j].CorrectAnswers, + DragItems: $scope.SavedLabExercise.labExercise[j].DragItems, + CorrectStatus: "Incorrect", + MaxScore: $scope.SavedLabExercise.labExercise[j].MaxScore, + QuestionNo: $scope.SavedLabExercise.labExercise[j].QuestionNo, + Score: $scope.SavedLabExercise.labExercise[j].Score, + UserAnswer: $scope.SavedLabExercise.labExercise[j].UserAnswers + }) + } + } } + } - // end code for generating report + console.log($scope.usersCorrectQuestData); for (var j = $scope.TotalNumberofQuiz; j >= 1; j--) { - for (var i = 0; i <= $scope.LabExerciseUserDataArray2.length - 1; i++) { - if (j == $scope.LabExerciseUserDataArray2[i].QuestionNo) { - if ($scope.LabExerciseUserDataArray2[i].CorrectStatus == "Correct") { - var labExerciseHtml = $("#resultLabData").append("" + $scope.LabExerciseUserDataArray2[i].QuestionNo + " " + $scope.LabExerciseUserDataArray2[i].CorrectStatus + ""); + for (var i = 0; i <= $scope.usersCorrectQuestData.length - 1; i++) { + if (j == $scope.usersCorrectQuestData[i].QuestionNo) { + if ($scope.usersCorrectQuestData[i].CorrectStatus == "Correct") { + var labExerciseHtml = $("#resultLabData").append("" + $scope.usersCorrectQuestData[i].QuestionNo + "" + $scope.usersCorrectQuestData[i].title + "" + $scope.usersCorrectQuestData[i].CorrectStatus + ""); $compile(labExerciseHtml)($scope); } else { - var labExerciseHtml = $("#resultLabData").append("" + $scope.LabExerciseUserDataArray2[i].QuestionNo + " " + $scope.LabExerciseUserDataArray2[i].CorrectStatus + ""); + var labExerciseHtml = $("#resultLabData").append("" + $scope.usersCorrectQuestData[i].QuestionNo + "" + $scope.usersCorrectQuestData[i].title + "" + $scope.usersCorrectQuestData[i].CorrectStatus + ""); $compile(labExerciseHtml)($scope); } $scope.isValueExist = true; @@ -432,6 +420,7 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, } } + for (var j = 1; j <= $scope.TotalNumberofQuiz; j++) { $("#resultLabData tr td:nth-child(1)").each(function () { if (j == $(this).text()) { @@ -464,7 +453,7 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, $scope.scoreResult = (parseInt($scope.CorrectAnswer) / parseInt($scope.TotalNumberofQuiz)) * 100; $scope.scoreResult = Math.round($scope.scoreResult); $("#resultLabData tr td:nth-child(2)").each(function (key, value) { - if ($(this).text().length == 1) { + if ($(this).text().length == 1 || $(this).text() == "undefined") { var a = parseInt($(this).prev().text()) - 1; $(this).text($scope.labExerciseModuleData[0].Questions[a].activityTitle); //if ($(this).next().text() == "Correct") { $(this).next().text("Correct"); } @@ -1199,12 +1188,14 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, var blockIds = []; //if user opted this question, it will have entry in LabExerciseUserData - var thisQuestiondataInLabExerciseUserData = new jinqJs() - .from($scope.LabExerciseUserData) - .where('QuestionNo == ' + $scope.quiznumber) - .select(); + if ($scope.LabExerciseUserData != undefined) { + var thisQuestiondataInLabExerciseUserData = new jinqJs() + .from($scope.LabExerciseUserData) + .where('QuestionNo == ' + $scope.quiznumber) + .select(); + } //if this exists in LabExerciseUserData, show the new opted else show from database var isFromDB = false; if (thisQuestiondataInLabExerciseUserData.length > 0) { @@ -1216,13 +1207,15 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, } else { - isFromDB = true; - lastQuestionDetails = new jinqJs() - .from($scope.SavedLabExercise.labExercise) - .where('QuestionNo == ' + lastQuestion) - .select(); - if (lastQuestionDetails != undefined && lastQuestionDetails.length > 0) - lastQuestionAnswers = lastQuestionDetails[0].UserAnswers.split(','); + if ($scope.SavedLabExercise != undefined) { + isFromDB = true; + lastQuestionDetails = new jinqJs() + .from($scope.SavedLabExercise.labExercise) + .where('QuestionNo == ' + lastQuestion) + .select(); + if (lastQuestionDetails != undefined && lastQuestionDetails.length > 0) + lastQuestionAnswers = lastQuestionDetails[0].UserAnswers.split(','); + } } if (lastQuestionDetails != undefined && lastQuestionDetails.length > 0) { $scope.QustionAnsKeyValue = []; diff --git a/400-SOURCECODE/AIAHTML5.Web/content/data/json/le/qz_dat_rp.json b/400-SOURCECODE/AIAHTML5.Web/content/data/json/le/qz_dat_rp.json index e735de9..537d95f 100644 --- a/400-SOURCECODE/AIAHTML5.Web/content/data/json/le/qz_dat_rp.json +++ b/400-SOURCECODE/AIAHTML5.Web/content/data/json/le/qz_dat_rp.json @@ -42,12 +42,12 @@ {"BoxName": "T3","topcoord":"188","leftcoord":"5","Answervalue":"","QuizText":""},{"BoxName": "T4","topcoord":"233","leftcoord":"5","Answervalue":"","QuizText":""}, {"BoxName": "T5","topcoord":"58","leftcoord":"944","Answervalue":"","QuizText":""},{"BoxName": "T6","topcoord":"104","leftcoord":"944","Answervalue":"","QuizText":""}, {"BoxName": "T7","topcoord":"219","leftcoord":"944","Answervalue":"","QuizText":""},{"BoxName": "T8","topcoord":"300","leftcoord":"944","Answervalue":"","QuizText":""}], - "Options": [{"OptionNumber": "A","OptionTitle": "Left ovary","textalign":"bottom"},{"OptionNumber": "B","OptionTitle": "Pubic symphysis","textalign":"bottom"}, - {"OptionNumber": "C","OptionTitle": "Fundus of uterus","textalign":"bottom"},{"OptionNumber": "D","OptionTitle": "Urinary bladder","textalign":"bottom"}, - {"OptionNumber": "E","OptionTitle": "Vagina","textalign":"bottom"},{"OptionNumber": "F","OptionTitle": "Labium minus","textalign":"bottom"}, - {"OptionNumber": "G","OptionTitle": "Urethra","textalign":"bottom"},{"OptionNumber": "H","OptionTitle": "Clitoris","textalign":"bottom"}], - "correctResponse": [{"OptionBox": "T1","Answer": "C"},{"OptionBox": "T2","Answer": "D"},{"OptionBox": "T3","Answer": "B"},{"OptionBox": "T4","Answer": "H"}, - {"OptionBox": "T5","Answer": "A"},{"OptionBox": "T6","Answer": "G"},{"OptionBox": "T7","Answer": "E"},{"OptionBox": "T8","Answer": "F"}] + "Options": [{"OptionNumber": "A","OptionTitle": "Uterine tube","textalign":"bottom"},{"OptionNumber": "B","OptionTitle": "Myometrium","textalign":"bottom"}, + {"OptionNumber": "C","OptionTitle": "Cervical canal","textalign":"bottom"},{"OptionNumber": "D","OptionTitle": "Pubic symphysisr","textalign":"bottom"}, + {"OptionNumber": "E","OptionTitle": "Urethra","textalign":"bottom"},{"OptionNumber": "F","OptionTitle": "Vagina","textalign":"bottom"}, + {"OptionNumber": "G","OptionTitle": "Endometrium","textalign":"bottom"},{"OptionNumber": "H","OptionTitle": "External os of cervix","textalign":"bottom"}], + "correctResponse": [{"OptionBox": "T1","Answer": "G"},{"OptionBox": "T2","Answer": "C"},{"OptionBox": "T3","Answer": "H"},{"OptionBox": "T4","Answer": "F"}, + {"OptionBox": "T5","Answer": "A"},{"OptionBox": "T6","Answer": "B"},{"OptionBox": "T7","Answer": "D"},{"OptionBox": "T8","Answer": "E"}] },{ "Number": "4", "Title": "Drag the labels to the correct location on the image.", diff --git a/400-SOURCECODE/AIAHTML5.Web/content/data/json/le/qz_dat_rs.json b/400-SOURCECODE/AIAHTML5.Web/content/data/json/le/qz_dat_rs.json index c80efeb..fcfcfcd 100644 --- a/400-SOURCECODE/AIAHTML5.Web/content/data/json/le/qz_dat_rs.json +++ b/400-SOURCECODE/AIAHTML5.Web/content/data/json/le/qz_dat_rs.json @@ -31,8 +31,8 @@ {"OptionNumber": "C","OptionTitle": "Middle nasal concha","textalign":"right"},{"OptionNumber": "D","OptionTitle": "Frontal sinus","textalign":"left"}, {"OptionNumber": "E","OptionTitle": "Superior nasal concha","textalign":"right"},{"OptionNumber": "F","OptionTitle": "Sphenoidal sinus","textalign":"left"}, {"OptionNumber": "G","OptionTitle": "Pharyngeal tonsil","textalign":"left"},{"OptionNumber": "H","OptionTitle": "Auditory tube","textalign":"right"}], - "correctResponse": [{"OptionBox": "T1","Answer": "A"},{"OptionBox": "T2","Answer": "B"},{"OptionBox": "T3","Answer": "C"},{"OptionBox": "T4","Answer": "D"}, - {"OptionBox": "T5","Answer": "E"},{"OptionBox": "T6","Answer": "F"},{"OptionBox": "T7","Answer": "E"},{"OptionBox": "T8","Answer": "F"}] + "correctResponse": [{"OptionBox": "T1","Answer": "D"},{"OptionBox": "T2","Answer": "C"},{"OptionBox": "T3","Answer": "B"},{"OptionBox": "T4","Answer": "A"}, + {"OptionBox": "T5","Answer": "E"},{"OptionBox": "T6","Answer": "F"},{"OptionBox": "T7","Answer": "G"},{"OptionBox": "T8","Answer": "H"}] },{ "Number": "3", "Title": "Drag the labels to the correct location on the image.", @@ -132,8 +132,8 @@ {"OptionNumber": "C","OptionTitle": "Esophagus","textalign":"bottom"},{"OptionNumber": "D","OptionTitle": "Aorta","textalign":"bottom"}, {"OptionNumber": "E","OptionTitle": "Diaphragm","textalign":"bottom"},{"OptionNumber": "F","OptionTitle": "Right inferior lobe","textalign":"bottom"}, {"OptionNumber": "G","OptionTitle": "Right middle lobe","textalign":"bottom"},{"OptionNumber": "H","OptionTitle": "Right superior lobe","textalign":"bottom"}], - "correctResponse": [{"OptionBox": "T1","Answer": "H"},{"OptionBox": "T2","Answer": "G"},{"OptionBox": "T3","Answer": "E"},{"OptionBox": "T4","Answer": "F"}, - {"OptionBox": "T5","Answer": "A"},{"OptionBox": "T6","Answer": "B"},{"OptionBox": "T7","Answer": "C"},{"OptionBox": "T8","Answer": "D"}] + "correctResponse": [{"OptionBox": "T1","Answer": "H"},{"OptionBox": "T2","Answer": "A"},{"OptionBox": "T3","Answer": "G"},{"OptionBox": "T4","Answer": "F"}, + {"OptionBox": "T5","Answer": "E"},{"OptionBox": "T6","Answer": "B"},{"OptionBox": "T7","Answer": "C"},{"OptionBox": "T8","Answer": "D"}] },{ "Number": "10", "Title": "Drag the labels to the correct location on the image.", diff --git a/400-SOURCECODE/AIAHTML5.Web/content/data/json/le/qz_dat_sk.json b/400-SOURCECODE/AIAHTML5.Web/content/data/json/le/qz_dat_sk.json index 01fbb01..575c23e 100644 --- a/400-SOURCECODE/AIAHTML5.Web/content/data/json/le/qz_dat_sk.json +++ b/400-SOURCECODE/AIAHTML5.Web/content/data/json/le/qz_dat_sk.json @@ -48,8 +48,8 @@ {"OptionNumber": "C","OptionTitle": "Mastoid process","textalign":"right"},{"OptionNumber": "D","OptionTitle": "Mandibular condyle","textalign":"left"}, {"OptionNumber": "E","OptionTitle": "Mandible","textalign":"left"},{"OptionNumber": "F","OptionTitle": "Maxilla","textalign":"right"}, {"OptionNumber": "G","OptionTitle": "Sphenoid bone","textalign":"left"}], - "correctResponse": [{"OptionBox": "T1","Answer": "B"},{"OptionBox": "T2","Answer": "F"},{"OptionBox": "T3","Answer": "A"},{"OptionBox": "T4","Answer": "D"}, - {"OptionBox": "T5","Answer": "E"},{"OptionBox": "T6","Answer": "C"},{"OptionBox": "T7","Answer": "G"}] + "correctResponse": [{"OptionBox": "T1","Answer": "A"},{"OptionBox": "T2","Answer": "B"},{"OptionBox": "T3","Answer": "C"},{"OptionBox": "T4","Answer": "G"}, + {"OptionBox": "T5","Answer": "D"},{"OptionBox": "T6","Answer": "F"},{"OptionBox": "T7","Answer": "E"}] },{ "Number": "4", "Title": "Drag the labels to the correct location on the image.", @@ -101,8 +101,8 @@ {"OptionNumber": "C","OptionTitle": "Radius","textalign":"left"},{"OptionNumber": "D","OptionTitle": "Capitulum of humerus","textalign":"left"}, {"OptionNumber": "E","OptionTitle": "Head of humerus","textalign":"left"},{"OptionNumber": "F","OptionTitle": "Acromion process of scapula","textalign":"right"}, {"OptionNumber": "G","OptionTitle": "Coracoid process of scapula","textalign":"right"},{"OptionNumber": "H","OptionTitle": "Clavicle","textalign":"right"}], - "correctResponse": [{"OptionBox": "T1","Answer": "A"},{"OptionBox": "T2","Answer": "H"},{"OptionBox": "T3","Answer": "E"},{"OptionBox": "T4","Answer": "G"}, - {"OptionBox": "T5","Answer": "B"},{"OptionBox": "T6","Answer": "C"},{"OptionBox": "T7","Answer": "D"},{"OptionBox": "T8","Answer": "F"}] + "correctResponse": [{"OptionBox": "T1","Answer": "F"},{"OptionBox": "T2","Answer": "E"},{"OptionBox": "T3","Answer": "D"},{"OptionBox": "T4","Answer": "C"}, + {"OptionBox": "T5","Answer": "H"},{"OptionBox": "T6","Answer": "G"},{"OptionBox": "T7","Answer": "B"},{"OptionBox": "T8","Answer": "A"}] },{ "Number": "8", "Title": "Drag the labels to the correct location on the image.",