Commit d01420a191a0e512322c56f2efe999904aef0c12
1 parent
a4e2111f
1. undefined check
2. Corrected json by verfied data from xml
Showing
4 changed files
with
73 additions
and
80 deletions
400-SOURCECODE/AIAHTML5.Web/app/controllers/LabExercController.js
... | ... | @@ -345,78 +345,66 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, |
345 | 345 | |
346 | 346 | |
347 | 347 | $scope.SubmitAttempt = function () { |
348 | - | |
348 | + | |
349 | 349 | $scope.CreateLabExerciseDataToSave(); |
350 | 350 | |
351 | 351 | $("#submitResultHtml").css("display", "block"); |
352 | 352 | $("#questionHtml").css("display", "none"); |
353 | - // console.log($scope.usersCorrectQuestData); | |
353 | + console.log($scope.usersCorrectQuestData); | |
354 | 354 | $("#resultLabData").empty(); |
355 | 355 | var sortedQuestionHtml = ''; |
356 | 356 | |
357 | - // start code for generating report | |
357 | + if ($scope.SavedLabExercise != undefined && $scope.SavedLabExercise.labExercise.length > 0) { | |
358 | + for (var j = 0; j <= $scope.SavedLabExercise.labExercise.length - 1; j++) { | |
359 | + var boolValueEx = false; | |
360 | + for (var i = 0; i <= $scope.usersCorrectQuestData.length - 1; i++) { | |
358 | 361 | |
359 | - $scope.LabExerciseUserDataArray1 = []; | |
360 | - $scope.LabExerciseUserDataArray2 = []; | |
361 | - $scope.LabExerciseUserDataArray1 = $scope.LabExerciseUserData; | |
362 | - // console.log($scope.LabExerciseUserData); | |
363 | - // console.log($scope.LabExerciseUserDataArray1); | |
364 | - | |
365 | - for (var i = 0; i <= $scope.SavedLabExercise.labExercise.length - 1; i++) { | |
366 | - | |
367 | - if ($scope.SavedLabExercise.labExercise[i].QuestionNo < $scope.LabExerciseUserDataArray1[0].QuestionNo) { | |
362 | + if ($scope.SavedLabExercise.labExercise[j].QuestionNo == $scope.usersCorrectQuestData[i].QuestionNo) { | |
363 | + boolValueEx = true; | |
364 | + break; | |
365 | + } | |
366 | + } | |
368 | 367 | |
369 | - $scope.LabExerciseUserDataArray1.push({ | |
370 | - "DragItems": $scope.SavedLabExercise.labExercise[i].DragItems, | |
371 | - "MaxScore": $scope.SavedLabExercise.labExercise[i].MaxScore, | |
372 | - "QuestionNo": $scope.SavedLabExercise.labExercise[i].QuestionNo, | |
373 | - "Score": $scope.SavedLabExercise.labExercise[i].Score, | |
374 | - "UserAnswer": $scope.SavedLabExercise.labExercise[i].UserAnswers, | |
375 | - "title": $scope.SavedLabExercise.labExercise[i].title | |
376 | - }) | |
377 | - | |
378 | - } | |
379 | - } | |
380 | - | |
381 | - for (var i = 0; i <= $scope.LabExerciseUserDataArray1.length - 1; i++) { | |
382 | - | |
383 | - if ($scope.LabExerciseUserDataArray1[i].MaxScore == $scope.LabExerciseUserDataArray1[i].Score) | |
384 | - { | |
385 | - $scope.LabExerciseUserDataArray2.push({ | |
386 | - "CorrectStatus": "Correct", | |
387 | - "DragItems": $scope.LabExerciseUserDataArray1[i].DragItems, | |
388 | - "MaxScore": $scope.LabExerciseUserDataArray1[i].MaxScore, | |
389 | - "QuestionNo": $scope.LabExerciseUserDataArray1[i].QuestionNo, | |
390 | - "Score": $scope.LabExerciseUserDataArray1[i].Score, | |
391 | - // "UserAnswer": $scope.LabExerciseUserDataArray1[i].UserAnswers, | |
392 | - // "title": $scope.LabExerciseUserDataArray1[i].title | |
393 | - }) | |
394 | - } | |
395 | - else { | |
396 | - $scope.LabExerciseUserDataArray2.push({ | |
397 | - "CorrectStatus": "Incorrect", | |
398 | - "DragItems": $scope.LabExerciseUserDataArray1[i].DragItems, | |
399 | - "MaxScore": $scope.LabExerciseUserDataArray1[i].MaxScore, | |
400 | - "QuestionNo": $scope.LabExerciseUserDataArray1[i].QuestionNo, | |
401 | - "Score": $scope.LabExerciseUserDataArray1[i].Score, | |
402 | - // "UserAnswer": $scope.LabExerciseUserDataArray1[i].UserAnswers, | |
403 | - // "title": $scope.LabExerciseUserDataArray1[i].title | |
404 | - }) | |
368 | + if (boolValueEx == false) { | |
369 | + if ($scope.SavedLabExercise.labExercise[j].MaxScore == $scope.SavedLabExercise.labExercise[j].Score) { | |
370 | + $scope.usersCorrectQuestData.push({ | |
371 | + CorrectAnswers: $scope.SavedLabExercise.labExercise[j].CorrectAnswers, | |
372 | + DragItems: $scope.SavedLabExercise.labExercise[j].DragItems, | |
373 | + CorrectStatus: "Correct", | |
374 | + MaxScore: $scope.SavedLabExercise.labExercise[j].MaxScore, | |
375 | + QuestionNo: $scope.SavedLabExercise.labExercise[j].QuestionNo, | |
376 | + Score: $scope.SavedLabExercise.labExercise[j].Score, | |
377 | + UserAnswer: $scope.SavedLabExercise.labExercise[j].UserAnswers | |
378 | + }) | |
379 | + } | |
380 | + else { | |
381 | + $scope.usersCorrectQuestData.push({ | |
382 | + CorrectAnswers: $scope.SavedLabExercise.labExercise[j].CorrectAnswers, | |
383 | + DragItems: $scope.SavedLabExercise.labExercise[j].DragItems, | |
384 | + CorrectStatus: "Incorrect", | |
385 | + MaxScore: $scope.SavedLabExercise.labExercise[j].MaxScore, | |
386 | + QuestionNo: $scope.SavedLabExercise.labExercise[j].QuestionNo, | |
387 | + Score: $scope.SavedLabExercise.labExercise[j].Score, | |
388 | + UserAnswer: $scope.SavedLabExercise.labExercise[j].UserAnswers | |
389 | + }) | |
390 | + } | |
391 | + } | |
405 | 392 | } |
393 | + | |
406 | 394 | } |
407 | 395 | |
408 | - // end code for generating report | |
396 | + console.log($scope.usersCorrectQuestData); | |
409 | 397 | |
410 | 398 | |
411 | 399 | for (var j = $scope.TotalNumberofQuiz; j >= 1; j--) { |
412 | - for (var i = 0; i <= $scope.LabExerciseUserDataArray2.length - 1; i++) { | |
413 | - if (j == $scope.LabExerciseUserDataArray2[i].QuestionNo) { | |
414 | - if ($scope.LabExerciseUserDataArray2[i].CorrectStatus == "Correct") { | |
415 | - 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>"); | |
400 | + for (var i = 0; i <= $scope.usersCorrectQuestData.length - 1; i++) { | |
401 | + if (j == $scope.usersCorrectQuestData[i].QuestionNo) { | |
402 | + if ($scope.usersCorrectQuestData[i].CorrectStatus == "Correct") { | |
403 | + 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>"); | |
416 | 404 | $compile(labExerciseHtml)($scope); |
417 | 405 | } |
418 | 406 | else { |
419 | - 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>"); | |
407 | + 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>"); | |
420 | 408 | $compile(labExerciseHtml)($scope); |
421 | 409 | } |
422 | 410 | $scope.isValueExist = true; |
... | ... | @@ -432,6 +420,7 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, |
432 | 420 | } |
433 | 421 | } |
434 | 422 | |
423 | + | |
435 | 424 | for (var j = 1; j <= $scope.TotalNumberofQuiz; j++) { |
436 | 425 | $("#resultLabData tr td:nth-child(1)").each(function () { |
437 | 426 | if (j == $(this).text()) { |
... | ... | @@ -464,7 +453,7 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, |
464 | 453 | $scope.scoreResult = (parseInt($scope.CorrectAnswer) / parseInt($scope.TotalNumberofQuiz)) * 100; |
465 | 454 | $scope.scoreResult = Math.round($scope.scoreResult); |
466 | 455 | $("#resultLabData tr td:nth-child(2)").each(function (key, value) { |
467 | - if ($(this).text().length == 1) { | |
456 | + if ($(this).text().length == 1 || $(this).text() == "undefined") { | |
468 | 457 | var a = parseInt($(this).prev().text()) - 1; |
469 | 458 | $(this).text($scope.labExerciseModuleData[0].Questions[a].activityTitle); |
470 | 459 | //if ($(this).next().text() == "Correct") { $(this).next().text("Correct"); } |
... | ... | @@ -1199,12 +1188,14 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, |
1199 | 1188 | var blockIds = []; |
1200 | 1189 | |
1201 | 1190 | //if user opted this question, it will have entry in LabExerciseUserData |
1202 | - var thisQuestiondataInLabExerciseUserData = new jinqJs() | |
1203 | - .from($scope.LabExerciseUserData) | |
1204 | - .where('QuestionNo == ' + $scope.quiznumber) | |
1205 | - .select(); | |
1191 | + if ($scope.LabExerciseUserData != undefined) { | |
1206 | 1192 | |
1193 | + var thisQuestiondataInLabExerciseUserData = new jinqJs() | |
1194 | + .from($scope.LabExerciseUserData) | |
1195 | + .where('QuestionNo == ' + $scope.quiznumber) | |
1196 | + .select(); | |
1207 | 1197 | |
1198 | + } | |
1208 | 1199 | //if this exists in LabExerciseUserData, show the new opted else show from database |
1209 | 1200 | var isFromDB = false; |
1210 | 1201 | if (thisQuestiondataInLabExerciseUserData.length > 0) { |
... | ... | @@ -1216,13 +1207,15 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, |
1216 | 1207 | } |
1217 | 1208 | |
1218 | 1209 | else { |
1219 | - isFromDB = true; | |
1220 | - lastQuestionDetails = new jinqJs() | |
1221 | - .from($scope.SavedLabExercise.labExercise) | |
1222 | - .where('QuestionNo == ' + lastQuestion) | |
1223 | - .select(); | |
1224 | - if (lastQuestionDetails != undefined && lastQuestionDetails.length > 0) | |
1225 | - lastQuestionAnswers = lastQuestionDetails[0].UserAnswers.split(','); | |
1210 | + if ($scope.SavedLabExercise != undefined) { | |
1211 | + isFromDB = true; | |
1212 | + lastQuestionDetails = new jinqJs() | |
1213 | + .from($scope.SavedLabExercise.labExercise) | |
1214 | + .where('QuestionNo == ' + lastQuestion) | |
1215 | + .select(); | |
1216 | + if (lastQuestionDetails != undefined && lastQuestionDetails.length > 0) | |
1217 | + lastQuestionAnswers = lastQuestionDetails[0].UserAnswers.split(','); | |
1218 | + } | |
1226 | 1219 | } |
1227 | 1220 | if (lastQuestionDetails != undefined && lastQuestionDetails.length > 0) { |
1228 | 1221 | $scope.QustionAnsKeyValue = []; | ... | ... |
400-SOURCECODE/AIAHTML5.Web/content/data/json/le/qz_dat_rp.json
... | ... | @@ -42,12 +42,12 @@ |
42 | 42 | {"BoxName": "T3","topcoord":"188","leftcoord":"5","Answervalue":"","QuizText":""},{"BoxName": "T4","topcoord":"233","leftcoord":"5","Answervalue":"","QuizText":""}, |
43 | 43 | {"BoxName": "T5","topcoord":"58","leftcoord":"944","Answervalue":"","QuizText":""},{"BoxName": "T6","topcoord":"104","leftcoord":"944","Answervalue":"","QuizText":""}, |
44 | 44 | {"BoxName": "T7","topcoord":"219","leftcoord":"944","Answervalue":"","QuizText":""},{"BoxName": "T8","topcoord":"300","leftcoord":"944","Answervalue":"","QuizText":""}], |
45 | - "Options": [{"OptionNumber": "A","OptionTitle": "Left ovary","textalign":"bottom"},{"OptionNumber": "B","OptionTitle": "Pubic symphysis","textalign":"bottom"}, | |
46 | - {"OptionNumber": "C","OptionTitle": "Fundus of uterus","textalign":"bottom"},{"OptionNumber": "D","OptionTitle": "Urinary bladder","textalign":"bottom"}, | |
47 | - {"OptionNumber": "E","OptionTitle": "Vagina","textalign":"bottom"},{"OptionNumber": "F","OptionTitle": "Labium minus","textalign":"bottom"}, | |
48 | - {"OptionNumber": "G","OptionTitle": "Urethra","textalign":"bottom"},{"OptionNumber": "H","OptionTitle": "Clitoris","textalign":"bottom"}], | |
49 | - "correctResponse": [{"OptionBox": "T1","Answer": "C"},{"OptionBox": "T2","Answer": "D"},{"OptionBox": "T3","Answer": "B"},{"OptionBox": "T4","Answer": "H"}, | |
50 | - {"OptionBox": "T5","Answer": "A"},{"OptionBox": "T6","Answer": "G"},{"OptionBox": "T7","Answer": "E"},{"OptionBox": "T8","Answer": "F"}] | |
45 | + "Options": [{"OptionNumber": "A","OptionTitle": "Uterine tube","textalign":"bottom"},{"OptionNumber": "B","OptionTitle": "Myometrium","textalign":"bottom"}, | |
46 | + {"OptionNumber": "C","OptionTitle": "Cervical canal","textalign":"bottom"},{"OptionNumber": "D","OptionTitle": "Pubic symphysisr","textalign":"bottom"}, | |
47 | + {"OptionNumber": "E","OptionTitle": "Urethra","textalign":"bottom"},{"OptionNumber": "F","OptionTitle": "Vagina","textalign":"bottom"}, | |
48 | + {"OptionNumber": "G","OptionTitle": "Endometrium","textalign":"bottom"},{"OptionNumber": "H","OptionTitle": "External os of cervix","textalign":"bottom"}], | |
49 | + "correctResponse": [{"OptionBox": "T1","Answer": "G"},{"OptionBox": "T2","Answer": "C"},{"OptionBox": "T3","Answer": "H"},{"OptionBox": "T4","Answer": "F"}, | |
50 | + {"OptionBox": "T5","Answer": "A"},{"OptionBox": "T6","Answer": "B"},{"OptionBox": "T7","Answer": "D"},{"OptionBox": "T8","Answer": "E"}] | |
51 | 51 | },{ |
52 | 52 | "Number": "4", |
53 | 53 | "Title": "Drag the labels to the correct location on the image.", | ... | ... |
400-SOURCECODE/AIAHTML5.Web/content/data/json/le/qz_dat_rs.json
... | ... | @@ -31,8 +31,8 @@ |
31 | 31 | {"OptionNumber": "C","OptionTitle": "Middle nasal concha","textalign":"right"},{"OptionNumber": "D","OptionTitle": "Frontal sinus","textalign":"left"}, |
32 | 32 | {"OptionNumber": "E","OptionTitle": "Superior nasal concha","textalign":"right"},{"OptionNumber": "F","OptionTitle": "Sphenoidal sinus","textalign":"left"}, |
33 | 33 | {"OptionNumber": "G","OptionTitle": "Pharyngeal tonsil","textalign":"left"},{"OptionNumber": "H","OptionTitle": "Auditory tube","textalign":"right"}], |
34 | - "correctResponse": [{"OptionBox": "T1","Answer": "A"},{"OptionBox": "T2","Answer": "B"},{"OptionBox": "T3","Answer": "C"},{"OptionBox": "T4","Answer": "D"}, | |
35 | - {"OptionBox": "T5","Answer": "E"},{"OptionBox": "T6","Answer": "F"},{"OptionBox": "T7","Answer": "E"},{"OptionBox": "T8","Answer": "F"}] | |
34 | + "correctResponse": [{"OptionBox": "T1","Answer": "D"},{"OptionBox": "T2","Answer": "C"},{"OptionBox": "T3","Answer": "B"},{"OptionBox": "T4","Answer": "A"}, | |
35 | + {"OptionBox": "T5","Answer": "E"},{"OptionBox": "T6","Answer": "F"},{"OptionBox": "T7","Answer": "G"},{"OptionBox": "T8","Answer": "H"}] | |
36 | 36 | },{ |
37 | 37 | "Number": "3", |
38 | 38 | "Title": "Drag the labels to the correct location on the image.", |
... | ... | @@ -132,8 +132,8 @@ |
132 | 132 | {"OptionNumber": "C","OptionTitle": "Esophagus","textalign":"bottom"},{"OptionNumber": "D","OptionTitle": "Aorta","textalign":"bottom"}, |
133 | 133 | {"OptionNumber": "E","OptionTitle": "Diaphragm","textalign":"bottom"},{"OptionNumber": "F","OptionTitle": "Right inferior lobe","textalign":"bottom"}, |
134 | 134 | {"OptionNumber": "G","OptionTitle": "Right middle lobe","textalign":"bottom"},{"OptionNumber": "H","OptionTitle": "Right superior lobe","textalign":"bottom"}], |
135 | - "correctResponse": [{"OptionBox": "T1","Answer": "H"},{"OptionBox": "T2","Answer": "G"},{"OptionBox": "T3","Answer": "E"},{"OptionBox": "T4","Answer": "F"}, | |
136 | - {"OptionBox": "T5","Answer": "A"},{"OptionBox": "T6","Answer": "B"},{"OptionBox": "T7","Answer": "C"},{"OptionBox": "T8","Answer": "D"}] | |
135 | + "correctResponse": [{"OptionBox": "T1","Answer": "H"},{"OptionBox": "T2","Answer": "A"},{"OptionBox": "T3","Answer": "G"},{"OptionBox": "T4","Answer": "F"}, | |
136 | + {"OptionBox": "T5","Answer": "E"},{"OptionBox": "T6","Answer": "B"},{"OptionBox": "T7","Answer": "C"},{"OptionBox": "T8","Answer": "D"}] | |
137 | 137 | },{ |
138 | 138 | "Number": "10", |
139 | 139 | "Title": "Drag the labels to the correct location on the image.", | ... | ... |
400-SOURCECODE/AIAHTML5.Web/content/data/json/le/qz_dat_sk.json
... | ... | @@ -48,8 +48,8 @@ |
48 | 48 | {"OptionNumber": "C","OptionTitle": "Mastoid process","textalign":"right"},{"OptionNumber": "D","OptionTitle": "Mandibular condyle","textalign":"left"}, |
49 | 49 | {"OptionNumber": "E","OptionTitle": "Mandible","textalign":"left"},{"OptionNumber": "F","OptionTitle": "Maxilla","textalign":"right"}, |
50 | 50 | {"OptionNumber": "G","OptionTitle": "Sphenoid bone","textalign":"left"}], |
51 | - "correctResponse": [{"OptionBox": "T1","Answer": "B"},{"OptionBox": "T2","Answer": "F"},{"OptionBox": "T3","Answer": "A"},{"OptionBox": "T4","Answer": "D"}, | |
52 | - {"OptionBox": "T5","Answer": "E"},{"OptionBox": "T6","Answer": "C"},{"OptionBox": "T7","Answer": "G"}] | |
51 | + "correctResponse": [{"OptionBox": "T1","Answer": "A"},{"OptionBox": "T2","Answer": "B"},{"OptionBox": "T3","Answer": "C"},{"OptionBox": "T4","Answer": "G"}, | |
52 | + {"OptionBox": "T5","Answer": "D"},{"OptionBox": "T6","Answer": "F"},{"OptionBox": "T7","Answer": "E"}] | |
53 | 53 | },{ |
54 | 54 | "Number": "4", |
55 | 55 | "Title": "Drag the labels to the correct location on the image.", |
... | ... | @@ -101,8 +101,8 @@ |
101 | 101 | {"OptionNumber": "C","OptionTitle": "Radius","textalign":"left"},{"OptionNumber": "D","OptionTitle": "Capitulum of humerus","textalign":"left"}, |
102 | 102 | {"OptionNumber": "E","OptionTitle": "Head of humerus","textalign":"left"},{"OptionNumber": "F","OptionTitle": "Acromion process of scapula","textalign":"right"}, |
103 | 103 | {"OptionNumber": "G","OptionTitle": "Coracoid process of scapula","textalign":"right"},{"OptionNumber": "H","OptionTitle": "Clavicle","textalign":"right"}], |
104 | - "correctResponse": [{"OptionBox": "T1","Answer": "A"},{"OptionBox": "T2","Answer": "H"},{"OptionBox": "T3","Answer": "E"},{"OptionBox": "T4","Answer": "G"}, | |
105 | - {"OptionBox": "T5","Answer": "B"},{"OptionBox": "T6","Answer": "C"},{"OptionBox": "T7","Answer": "D"},{"OptionBox": "T8","Answer": "F"}] | |
104 | + "correctResponse": [{"OptionBox": "T1","Answer": "F"},{"OptionBox": "T2","Answer": "E"},{"OptionBox": "T3","Answer": "D"},{"OptionBox": "T4","Answer": "C"}, | |
105 | + {"OptionBox": "T5","Answer": "H"},{"OptionBox": "T6","Answer": "G"},{"OptionBox": "T7","Answer": "B"},{"OptionBox": "T8","Answer": "A"}] | |
106 | 106 | },{ |
107 | 107 | "Number": "8", |
108 | 108 | "Title": "Drag the labels to the correct location on the image.", | ... | ... |