Skip to content

Commit 667c42e

Browse files
committed
Remove erroneous completion call
1 parent bbd2e8c commit 667c42e

File tree

8 files changed

+15
-74
lines changed

8 files changed

+15
-74
lines changed

go-app-fbmessengerapp.js

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -670,22 +670,6 @@ go.utils_project = {
670670
return {"quiz": quiz, "questions_remaining": questions_array, "questions_answered": [], "completed": false};
671671
},
672672

673-
set_quiz_completed: function(im, user_id, quiz_status) {
674-
quiz_status.completed = true;
675-
676-
var endpoint = "completed/";
677-
var payload = {
678-
"identity": user_id,
679-
"quiz": quiz_status.quiz
680-
};
681-
682-
return go.utils
683-
.service_api_call("continuous-learning", "post", {}, payload, endpoint, im)
684-
.then(function(json_get_response) {
685-
return json_get_response.data;
686-
});
687-
},
688-
689673
// update the questions and answer part of user's quiz status
690674
save_quiz_status: function(im) {
691675
return go.utils
@@ -1009,11 +993,8 @@ go.app = function() {
1009993
if (self.im.user.answers.quiz_status.questions_remaining.length !== 0) {
1010994
return 'state_save_quiz_status';
1011995
} else {
1012-
return go.utils_project
1013-
.set_quiz_completed(self.im, self.im.user.answers.user_id, self.im.user.answers.quiz_status)
1014-
.then(function() {
1015-
return 'state_save_quiz_status';
1016-
});
996+
self.im.user.answers.quiz_status.completed = true;
997+
return 'state_save_quiz_status';
1017998
}
1018999
}
10191000
});

go-app-ussdapp.js

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -670,22 +670,6 @@ go.utils_project = {
670670
return {"quiz": quiz, "questions_remaining": questions_array, "questions_answered": [], "completed": false};
671671
},
672672

673-
set_quiz_completed: function(im, user_id, quiz_status) {
674-
quiz_status.completed = true;
675-
676-
var endpoint = "completed/";
677-
var payload = {
678-
"identity": user_id,
679-
"quiz": quiz_status.quiz
680-
};
681-
682-
return go.utils
683-
.service_api_call("continuous-learning", "post", {}, payload, endpoint, im)
684-
.then(function(json_get_response) {
685-
return json_get_response.data;
686-
});
687-
},
688-
689673
// update the questions and answer part of user's quiz status
690674
save_quiz_status: function(im) {
691675
return go.utils
@@ -1008,11 +992,8 @@ go.app = function() {
1008992
if (self.im.user.answers.quiz_status.questions_remaining.length !== 0) {
1009993
return 'state_save_quiz_status';
1010994
} else {
1011-
return go.utils_project
1012-
.set_quiz_completed(self.im, self.im.user.answers.user_id, self.im.user.answers.quiz_status)
1013-
.then(function() {
1014-
return 'state_save_quiz_status';
1015-
});
995+
self.im.user.answers.quiz_status.completed = true;
996+
return 'state_save_quiz_status';
1016997
}
1017998
}
1018999
});

src/fbmessengerapp.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -224,11 +224,8 @@ go.app = function() {
224224
if (self.im.user.answers.quiz_status.questions_remaining.length !== 0) {
225225
return 'state_save_quiz_status';
226226
} else {
227-
return go.utils_project
228-
.set_quiz_completed(self.im, self.im.user.answers.user_id, self.im.user.answers.quiz_status)
229-
.then(function() {
230-
return 'state_save_quiz_status';
231-
});
227+
self.im.user.answers.quiz_status.completed = true;
228+
return 'state_save_quiz_status';
232229
}
233230
}
234231
});

src/ussdapp.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -223,11 +223,8 @@ go.app = function() {
223223
if (self.im.user.answers.quiz_status.questions_remaining.length !== 0) {
224224
return 'state_save_quiz_status';
225225
} else {
226-
return go.utils_project
227-
.set_quiz_completed(self.im, self.im.user.answers.user_id, self.im.user.answers.quiz_status)
228-
.then(function() {
229-
return 'state_save_quiz_status';
230-
});
226+
self.im.user.answers.quiz_status.completed = true;
227+
return 'state_save_quiz_status';
231228
}
232229
}
233230
});

src/utils_project.js

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -96,22 +96,6 @@ go.utils_project = {
9696
return {"quiz": quiz, "questions_remaining": questions_array, "questions_answered": [], "completed": false};
9797
},
9898

99-
set_quiz_completed: function(im, user_id, quiz_status) {
100-
quiz_status.completed = true;
101-
102-
var endpoint = "completed/";
103-
var payload = {
104-
"identity": user_id,
105-
"quiz": quiz_status.quiz
106-
};
107-
108-
return go.utils
109-
.service_api_call("continuous-learning", "post", {}, payload, endpoint, im)
110-
.then(function(json_get_response) {
111-
return json_get_response.data;
112-
});
113-
},
114-
11599
// update the questions and answer part of user's quiz status
116100
save_quiz_status: function(im) {
117101
return go.utils

test/fbmessengerapp.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ describe("UoP TB registration/quiz app", function() {
315315
reply: "Thank you for completing your quiz. You correctly answered 3 of 3 questions. Your score is 100%"
316316
})
317317
.check(function(api) {
318-
go.utils.check_fixtures_used(api,[6,9,13,14,15,25,26,27,28,31,32,34,36,38,41]);
318+
go.utils.check_fixtures_used(api,[6,9,13,14,15,25,26,28,31,32,34,36,38,41]);
319319
})
320320
.run();
321321
});
@@ -355,7 +355,7 @@ describe("UoP TB registration/quiz app", function() {
355355
reply: "Thank you for completing your quiz. You correctly answered 1 of 3 questions. Your score is 33%"
356356
})
357357
.check(function(api) {
358-
go.utils.check_fixtures_used(api,[6,9,13,14,15,25,26,27,29,31,33,34,37,38,41]);
358+
go.utils.check_fixtures_used(api,[6,9,13,14,15,25,26,29,31,33,34,37,38,41]);
359359
})
360360
.run();
361361
});
@@ -376,7 +376,7 @@ describe("UoP TB registration/quiz app", function() {
376376
reply: "Thank you for completing your quiz. You correctly answered 1 of 3 questions. Your score is 33%"
377377
})
378378
.check(function(api) {
379-
go.utils.check_fixtures_used(api,[6,9,13,14,15,25,26,27,30,31,33,35,36,38,41]);
379+
go.utils.check_fixtures_used(api,[6,9,13,14,15,25,26,30,31,33,35,36,38,41]);
380380
})
381381
.run();
382382
});

test/fixtures.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,6 +1003,7 @@ return [
10031003

10041004
// 27: mark quiz cb245673-aa41-4302-ac47-q0000000111 as completed
10051005
// for identity cb245673-aa41-4302-ac47-00000000111
1006+
// not used now
10061007
{
10071008
"request": {
10081009
"method": "POST",

test/ussdapp.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ describe("UoP TB registration/quiz app", function() {
309309
reply: "Thank you for completing your quiz. You correctly answered 3 of 3 questions. Your score is 100%"
310310
})
311311
.check(function(api) {
312-
go.utils.check_fixtures_used(api,[0,6,9,13,14,15,25,26,27,28,31,32,34,36,38]);
312+
go.utils.check_fixtures_used(api,[0,6,9,13,14,15,25,26,28,31,32,34,36,38]);
313313
})
314314
.run();
315315
});
@@ -349,7 +349,7 @@ describe("UoP TB registration/quiz app", function() {
349349
reply: "Thank you for completing your quiz. You correctly answered 1 of 3 questions. Your score is 33%"
350350
})
351351
.check(function(api) {
352-
go.utils.check_fixtures_used(api,[0,6,9,13,14,15,25,26,27,29,31,33,34,37,38]);
352+
go.utils.check_fixtures_used(api,[0,6,9,13,14,15,25,26,29,31,33,34,37,38]);
353353
})
354354
.run();
355355
});
@@ -370,7 +370,7 @@ describe("UoP TB registration/quiz app", function() {
370370
reply: "Thank you for completing your quiz. You correctly answered 1 of 3 questions. Your score is 33%"
371371
})
372372
.check(function(api) {
373-
go.utils.check_fixtures_used(api,[0,6,9,13,14,15,25,26,27,30,31,33,35,36,38]);
373+
go.utils.check_fixtures_used(api,[0,6,9,13,14,15,25,26,30,31,33,35,36,38]);
374374
})
375375
.run();
376376
});

0 commit comments

Comments
 (0)