Ubuntu

Fix app.js

Showing 1 changed file with 13 additions and 13 deletions
...@@ -201,7 +201,7 @@ apiRouter.post('/question4', (req, res) => { ...@@ -201,7 +201,7 @@ apiRouter.post('/question4', (req, res) => {
201 201
202 apiRouter.post('/question5', (req, res) => { 202 apiRouter.post('/question5', (req, res) => {
203 var userId = req.body.userRequest.user.id; 203 var userId = req.body.userRequest.user.id;
204 - var mesg = req.body.userRequest; 204 + var mesg = req.body.userRequest.utterance;
205 console.log('[q1:user message] ', mesg); 205 console.log('[q1:user message] ', mesg);
206 var mbti = ''; 206 var mbti = '';
207 if (mesg == "네") { 207 if (mesg == "네") {
...@@ -332,7 +332,7 @@ apiRouter.post('/question8', (req, res) => { ...@@ -332,7 +332,7 @@ apiRouter.post('/question8', (req, res) => {
332 } else if (mesg == "아니오") { 332 } else if (mesg == "아니오") {
333 mbti = 'F'; 333 mbti = 'F';
334 } 334 }
335 - userDB[userId][1] += mbti; 335 + userDB[userId][2] += mbti;
336 console.log(userDB[userId]); 336 console.log(userDB[userId]);
337 const responseBody = { 337 const responseBody = {
338 version: "2.0", 338 version: "2.0",
...@@ -374,7 +374,7 @@ apiRouter.post('/question8', (req, res) => { ...@@ -374,7 +374,7 @@ apiRouter.post('/question8', (req, res) => {
374 mbti = 'J'; 374 mbti = 'J';
375 } 375 }
376 userDB[userId][3] += mbti; 376 userDB[userId][3] += mbti;
377 - console.log(userDB); 377 + console.log(userDB[userId]);
378 const responseBody = { 378 const responseBody = {
379 version: "2.0", 379 version: "2.0",
380 template: { 380 template: {
...@@ -415,7 +415,7 @@ apiRouter.post('/question8', (req, res) => { ...@@ -415,7 +415,7 @@ apiRouter.post('/question8', (req, res) => {
415 mbti = 'E'; 415 mbti = 'E';
416 } 416 }
417 userDB[userId][0] += mbti; 417 userDB[userId][0] += mbti;
418 - console.log(userDB); 418 + console.log(userDB[userId]);
419 const responseBody = { 419 const responseBody = {
420 version: "2.0", 420 version: "2.0",
421 template: { 421 template: {
...@@ -456,7 +456,7 @@ apiRouter.post('/question8', (req, res) => { ...@@ -456,7 +456,7 @@ apiRouter.post('/question8', (req, res) => {
456 mbti = 'N'; 456 mbti = 'N';
457 } 457 }
458 userDB[userId][1] += mbti; 458 userDB[userId][1] += mbti;
459 - console.log(userDB); 459 + console.log(userDB[userId]);
460 const responseBody = { 460 const responseBody = {
461 version: "2.0", 461 version: "2.0",
462 template: { 462 template: {
...@@ -497,7 +497,7 @@ apiRouter.post('/question8', (req, res) => { ...@@ -497,7 +497,7 @@ apiRouter.post('/question8', (req, res) => {
497 mbti = 'T'; 497 mbti = 'T';
498 } 498 }
499 userDB[userId][2] += mbti; 499 userDB[userId][2] += mbti;
500 - console.log(userDB); 500 + console.log(userDB[userId]);
501 const responseBody = { 501 const responseBody = {
502 version: "2.0", 502 version: "2.0",
503 template: { 503 template: {
...@@ -538,7 +538,7 @@ apiRouter.post('/question8', (req, res) => { ...@@ -538,7 +538,7 @@ apiRouter.post('/question8', (req, res) => {
538 mbti = 'P'; 538 mbti = 'P';
539 } 539 }
540 userDB[userId][3] += mbti; 540 userDB[userId][3] += mbti;
541 - console.log(userDB); 541 + console.log(userDB[userId]);
542 const responseBody = { 542 const responseBody = {
543 version: "2.0", 543 version: "2.0",
544 template: { 544 template: {
...@@ -579,7 +579,7 @@ apiRouter.post('/question8', (req, res) => { ...@@ -579,7 +579,7 @@ apiRouter.post('/question8', (req, res) => {
579 mbti = 'E'; 579 mbti = 'E';
580 } 580 }
581 userDB[userId][0] += mbti; 581 userDB[userId][0] += mbti;
582 - console.log(userDB); 582 + console.log(userDB[userId]);
583 const responseBody = { 583 const responseBody = {
584 version: "2.0", 584 version: "2.0",
585 template: { 585 template: {
...@@ -619,8 +619,8 @@ apiRouter.post('/question8', (req, res) => { ...@@ -619,8 +619,8 @@ apiRouter.post('/question8', (req, res) => {
619 else if (mesg == "아니오") { 619 else if (mesg == "아니오") {
620 mbti = 'S'; 620 mbti = 'S';
621 } 621 }
622 - userDB[userId][0] += mbti; 622 + userDB[userId][1] += mbti;
623 - console.log(userDB); 623 + console.log(userDB[userId]);
624 const responseBody = { 624 const responseBody = {
625 version: "2.0", 625 version: "2.0",
626 template: { 626 template: {
...@@ -861,8 +861,8 @@ apiRouter.post('/result', (req, res) => { ...@@ -861,8 +861,8 @@ apiRouter.post('/result', (req, res) => {
861 } 861 }
862 userDB[userId][3] += mbti; 862 userDB[userId][3] += mbti;
863 console.log(userDB[userId]); 863 console.log(userDB[userId]);
864 - analysis_mbti(userDB[userId]); 864 + analysis_mbti(userDB[userId]);
865 - const responseBody = { 865 + const responseBody = {
866 version: "2.0", 866 version: "2.0",
867 template: { 867 template: {
868 outputs: [ 868 outputs: [
...@@ -988,7 +988,7 @@ function analysis_mbti(userdb) { ...@@ -988,7 +988,7 @@ function analysis_mbti(userdb) {
988 function count_mbti(item_list, mbti_ch) { 988 function count_mbti(item_list, mbti_ch) {
989 var result = 0; 989 var result = 0;
990 for (var i=0; i<5; i++) { 990 for (var i=0; i<5; i++) {
991 - if(item_list[i] == 'mbti_ch'){ 991 + if(item_list[i] == mbti_ch){
992 result += 1; 992 result += 1;
993 } 993 }
994 } 994 }
......