Commit 4147a3d3da645928b54e77b6b60f93b3653702c0
1 parent
335f4bd9
Commit Changes
Showing
2 changed files
with
82 additions
and
13 deletions
400-SOURCECODE/AIAHTML5.Web/app/controllers/LabExercController.js
@@ -154,7 +154,9 @@ function ($scope, $rootScope, pages, log, $http, DataService, $filter, $location | @@ -154,7 +154,9 @@ function ($scope, $rootScope, pages, log, $http, DataService, $filter, $location | ||
154 | } | 154 | } |
155 | ) | 155 | ) |
156 | } | 156 | } |
157 | + | ||
157 | $scope.isReviewBtnSelected = false; | 158 | $scope.isReviewBtnSelected = false; |
159 | + $rootScope.selectedDivArray = []; | ||
158 | $scope.nextQuiz = function () { | 160 | $scope.nextQuiz = function () { |
159 | 161 | ||
160 | //need to save all questions till the current question number when user clicks on save | 162 | //need to save all questions till the current question number when user clicks on save |
@@ -171,12 +173,7 @@ function ($scope, $rootScope, pages, log, $http, DataService, $filter, $location | @@ -171,12 +173,7 @@ function ($scope, $rootScope, pages, log, $http, DataService, $filter, $location | ||
171 | $scope.CreateLabExerciseDataToSave(); | 173 | $scope.CreateLabExerciseDataToSave(); |
172 | } | 174 | } |
173 | 175 | ||
174 | - //{ | ||
175 | - // $scope.selectedQuestionNo = $scope.quiznumber + 1; | ||
176 | - // $scope.CreateLabExerciseDataToSave(); | ||
177 | - //} | ||
178 | - | ||
179 | - | 176 | + console.log($rootScope.selectedDivArray); |
180 | $scope.dragableId = ""; | 177 | $scope.dragableId = ""; |
181 | if ($scope.quiznumber == $scope.TotalNumberofQuiz) | 178 | if ($scope.quiznumber == $scope.TotalNumberofQuiz) |
182 | return; | 179 | return; |
@@ -200,11 +197,22 @@ function ($scope, $rootScope, pages, log, $http, DataService, $filter, $location | @@ -200,11 +197,22 @@ function ($scope, $rootScope, pages, log, $http, DataService, $filter, $location | ||
200 | 197 | ||
201 | $scope.resetQuiz(); | 198 | $scope.resetQuiz(); |
202 | $scope.ShowHideDiv(); | 199 | $scope.ShowHideDiv(); |
200 | + | ||
203 | 201 | ||
204 | 202 | ||
205 | } | 203 | } |
206 | 204 | ||
205 | + | ||
206 | + | ||
207 | + | ||
208 | + | ||
209 | + | ||
210 | + | ||
211 | + | ||
212 | + | ||
213 | + | ||
207 | $scope.prevQuiz = function () { | 214 | $scope.prevQuiz = function () { |
215 | + debugger; | ||
208 | if ($scope.quiznumber != 1) { | 216 | if ($scope.quiznumber != 1) { |
209 | // $scope.quizQuesNo = $scope.quizQuesNo - 1; | 217 | // $scope.quizQuesNo = $scope.quizQuesNo - 1; |
210 | // $scope.selectedQuestionNo = $scope.quizQuesNo; | 218 | // $scope.selectedQuestionNo = $scope.quizQuesNo; |
@@ -230,10 +238,21 @@ function ($scope, $rootScope, pages, log, $http, DataService, $filter, $location | @@ -230,10 +238,21 @@ function ($scope, $rootScope, pages, log, $http, DataService, $filter, $location | ||
230 | } | 238 | } |
231 | $scope.resetQuiz(); | 239 | $scope.resetQuiz(); |
232 | $scope.ShowHideDiv(); | 240 | $scope.ShowHideDiv(); |
241 | + | ||
242 | + for (var i = 0; i <= $rootScope.selectedDivArray.length - 1; i++) { | ||
243 | + if ($scope.quiznumber == $rootScope.selectedDivArray[i].questionNo) { | ||
244 | + document.getElementById($rootScope.selectedDivArray[i].droppedID).innerHTML = $rootScope.selectedDivArray[i].draggedText; | ||
245 | + // $('#'+$rootScope.selectedDivArray[i].droppedID).html($rootScope.selectedDivArray[i].draggedText); | ||
246 | + document.getElementById($rootScope.selectedDivArray[i].droppedID).style.display = "none"; | ||
247 | + // $('#'+$rootScope.selectedDivArray[i].draggedID).css("display","none!important"); | ||
248 | + } | ||
249 | + | ||
250 | + } | ||
233 | } | 251 | } |
234 | 252 | ||
235 | 253 | ||
236 | $scope.SubmitAttempt = function () { | 254 | $scope.SubmitAttempt = function () { |
255 | + debugger; | ||
237 | $scope.CreateLabExerciseDataToSave(); | 256 | $scope.CreateLabExerciseDataToSave(); |
238 | 257 | ||
239 | $("#submitResultHtml").css("display", "block"); | 258 | $("#submitResultHtml").css("display", "block"); |
@@ -241,7 +260,7 @@ function ($scope, $rootScope, pages, log, $http, DataService, $filter, $location | @@ -241,7 +260,7 @@ function ($scope, $rootScope, pages, log, $http, DataService, $filter, $location | ||
241 | console.log($scope.usersCorrectQuestData); | 260 | console.log($scope.usersCorrectQuestData); |
242 | $("#resultLabData").empty(); | 261 | $("#resultLabData").empty(); |
243 | for (var i = 0; i <= $scope.usersCorrectQuestData.length - 1; i++) { | 262 | for (var i = 0; i <= $scope.usersCorrectQuestData.length - 1; i++) { |
244 | - 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(" + $scope.usersCorrectQuestData[i].QuestionNo + ");' id=" + $scope.usersCorrectQuestData[i].QuestionNo + " class='btn btn-danger btn-sm'><i class='fa fa-times'></i> Review</button></td></tr>"); | 263 | + 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-danger btn-sm'><i class='fa fa-times'></i> Review</button></td></tr>"); |
245 | $compile(labExerciseHtml)($scope); | 264 | $compile(labExerciseHtml)($scope); |
246 | } | 265 | } |
247 | } | 266 | } |
@@ -258,6 +277,9 @@ function ($scope, $rootScope, pages, log, $http, DataService, $filter, $location | @@ -258,6 +277,9 @@ function ($scope, $rootScope, pages, log, $http, DataService, $filter, $location | ||
258 | this.style.opacity = '0.4'; | 277 | this.style.opacity = '0.4'; |
259 | e.dataTransfer.setData('text/plain', this.innerHTML); | 278 | e.dataTransfer.setData('text/plain', this.innerHTML); |
260 | $scope.dragableId = $(this).attr("Id"); | 279 | $scope.dragableId = $(this).attr("Id"); |
280 | + // alert($scope.dragableId); | ||
281 | + $scope.dragableText = $("#" + $scope.dragableId).text(); | ||
282 | + // alert($("#" + $scope.dragableId).text()); | ||
261 | 283 | ||
262 | //if user drag already selected answer from one blankbox to another than it gets id of blank box so need to get answer | 284 | //if user drag already selected answer from one blankbox to another than it gets id of blank box so need to get answer |
263 | if ($scope.dragableId.indexOf('T') != -1) { | 285 | if ($scope.dragableId.indexOf('T') != -1) { |
@@ -287,6 +309,18 @@ function ($scope, $rootScope, pages, log, $http, DataService, $filter, $location | @@ -287,6 +309,18 @@ function ($scope, $rootScope, pages, log, $http, DataService, $filter, $location | ||
287 | //alert(x.left + "," + $("#droppable").clientWidth + "," + x.top); | 309 | //alert(x.left + "," + $("#droppable").clientWidth + "," + x.top); |
288 | 310 | ||
289 | var id = $(this).attr("id"); | 311 | var id = $(this).attr("id"); |
312 | + // alert($scope.dragableId); | ||
313 | + // $scope.dragableText = $("#" + $scope.dragableId).text(); | ||
314 | + | ||
315 | + $rootScope.selectedDivArray.push({ | ||
316 | + "questionNo": $scope.quiznumber, | ||
317 | + "draggedID": $scope.dragableId, | ||
318 | + "draggedText": $scope.dragableText, | ||
319 | + "droppedID": id | ||
320 | + }); | ||
321 | + | ||
322 | + | ||
323 | + console.log($rootScope.selectedDivArray); | ||
290 | 324 | ||
291 | var keywords = $location.search(); | 325 | var keywords = $location.search(); |
292 | $scope.labExercideIdentifier = (keywords.labexercise.replace('.json', '')).split('dat_')[1]; | 326 | $scope.labExercideIdentifier = (keywords.labexercise.replace('.json', '')).split('dat_')[1]; |
@@ -383,6 +417,8 @@ function ($scope, $rootScope, pages, log, $http, DataService, $filter, $location | @@ -383,6 +417,8 @@ function ($scope, $rootScope, pages, log, $http, DataService, $filter, $location | ||
383 | // $("#divoptions").html("<br><br><br><br>") | 417 | // $("#divoptions").html("<br><br><br><br>") |
384 | //} | 418 | //} |
385 | //alert(JSON.stringify($scope.UserAttempt)); | 419 | //alert(JSON.stringify($scope.UserAttempt)); |
420 | + | ||
421 | + | ||
386 | }; | 422 | }; |
387 | 423 | ||
388 | $scope.handleDragOver = function (e) { | 424 | $scope.handleDragOver = function (e) { |
@@ -473,7 +509,7 @@ function ($scope, $rootScope, pages, log, $http, DataService, $filter, $location | @@ -473,7 +509,7 @@ function ($scope, $rootScope, pages, log, $http, DataService, $filter, $location | ||
473 | 509 | ||
474 | $scope.usersCorrectQuestData = []; | 510 | $scope.usersCorrectQuestData = []; |
475 | $scope.CreateLabExerciseDataToSave = function () { | 511 | $scope.CreateLabExerciseDataToSave = function () { |
476 | - | 512 | + debugger; |
477 | $scope.LabExerciseAttemptedData = []; | 513 | $scope.LabExerciseAttemptedData = []; |
478 | $scope.lb = []; | 514 | $scope.lb = []; |
479 | //get user answers | 515 | //get user answers |
@@ -507,8 +543,8 @@ function ($scope, $rootScope, pages, log, $http, DataService, $filter, $location | @@ -507,8 +543,8 @@ function ($scope, $rootScope, pages, log, $http, DataService, $filter, $location | ||
507 | title: $scope.activityTitle, | 543 | title: $scope.activityTitle, |
508 | } | 544 | } |
509 | 545 | ||
510 | - | ||
511 | - if($scope.LabExerciseAttemptedData.MaxScore == $scope.LabExerciseAttemptedData.Score) | 546 | + alert($scope.LabExerciseAttemptedData.MaxScore + " " + $scope.LabExerciseAttemptedData.Score); |
547 | + if ($scope.MaxScore == $scope.Score) | ||
512 | { | 548 | { |
513 | $scope.usersCorrectQuestData.push({ | 549 | $scope.usersCorrectQuestData.push({ |
514 | MaxScore: $scope.MaxScore, | 550 | MaxScore: $scope.MaxScore, |
@@ -560,7 +596,7 @@ function ($scope, $rootScope, pages, log, $http, DataService, $filter, $location | @@ -560,7 +596,7 @@ function ($scope, $rootScope, pages, log, $http, DataService, $filter, $location | ||
560 | $scope.LabExerciseUserData.push($scope.LabExerciseAttemptedData); | 596 | $scope.LabExerciseUserData.push($scope.LabExerciseAttemptedData); |
561 | } | 597 | } |
562 | 598 | ||
563 | - $scope.reviewAttemptAnswer = function () { | 599 | + $scope.reviewAttemptAnswer = function (evt) { |
564 | $scope.isReviewBtnSelected = true; | 600 | $scope.isReviewBtnSelected = true; |
565 | $("#reviewBtn").css("display", "none"); | 601 | $("#reviewBtn").css("display", "none"); |
566 | $("#resetBtn").css("display", "none"); | 602 | $("#resetBtn").css("display", "none"); |
@@ -568,8 +604,12 @@ function ($scope, $rootScope, pages, log, $http, DataService, $filter, $location | @@ -568,8 +604,12 @@ function ($scope, $rootScope, pages, log, $http, DataService, $filter, $location | ||
568 | $("#submitResultHtml").css("display", "none"); | 604 | $("#submitResultHtml").css("display", "none"); |
569 | $("#questionHtml").css("display", "block"); | 605 | $("#questionHtml").css("display", "block"); |
570 | $("#reportBtn").css("display", "block"); | 606 | $("#reportBtn").css("display", "block"); |
571 | - $scope.quiznumber = 1; | ||
572 | - $scope.nextQuiz(); | 607 | + $("#quizSubmitBtn").css("display", "none"); |
608 | + $scope.quiznumber = evt.target.id; | ||
609 | + $scope.CreateLabExerciseDataToSave(); | ||
610 | + $scope.dragableId = ""; | ||
611 | + $scope.resetQuiz(); | ||
612 | + $scope.ShowHideDiv(); | ||
573 | } | 613 | } |
574 | 614 | ||
575 | 615 |
400-SOURCECODE/AIAHTML5.Web/app/services/LabExerciseService.js
0 → 100644
1 | +AIA.factory('LabExerciseService', function ($http, $q, $rootScope) { | ||
2 | + return { | ||
3 | + saveLabExerciseAttempt: function (labExercieObj) { | ||
4 | + var deferred = $q.defer(); | ||
5 | + $http.post('/API/api/LabExercise', JSON.stringify(labExercieObj), { | ||
6 | + headers: { | ||
7 | + 'Content-Type': 'application/json' | ||
8 | + } | ||
9 | + }) | ||
10 | + //$http.post('/API/api/LabExercise', JSON.stringify(labExercieObj, userId, labExerciseIdentifier, LastQuestion, TotalQuestions), { | ||
11 | + // headers: { | ||
12 | + // 'Content-Type': 'application/json' | ||
13 | + // } | ||
14 | + //}) | ||
15 | + .success(function (data, status, headers, config) { | ||
16 | + console.log('success') | ||
17 | + deferred.resolve(data); | ||
18 | + }).error(function (data, status, headers, config) { | ||
19 | + console.log('error') | ||
20 | + deferred.reject(data); | ||
21 | + $rootScope.isVisibleLogin = true; | ||
22 | + $rootScope.errorMessage = data; | ||
23 | + $("#messageModal").modal('show'); | ||
24 | + | ||
25 | + }); | ||
26 | + return deferred.promise; | ||
27 | + }, | ||
28 | + } | ||
29 | +}) | ||
0 | \ No newline at end of file | 30 | \ No newline at end of file |