공정훈

Fix add mbti

...@@ -73,8 +73,7 @@ apiRouter.post('/test', (req, res) => { ...@@ -73,8 +73,7 @@ apiRouter.post('/test', (req, res) => {
73 73
74 apiRouter.post('/question15', (req, res) => { 74 apiRouter.post('/question15', (req, res) => {
75 var userId = req.body.userRequest.user.id; 75 var userId = req.body.userRequest.user.id;
76 - var mesg = req.body.userRequest; 76 + userDB[userId] = ['','','','',''];
77 - userDB[userId] = ['','','','',''];//new Array(5);
78 const responseBody = { 77 const responseBody = {
79 version: "2.0", 78 version: "2.0",
80 template: { 79 template: {
...@@ -106,13 +105,16 @@ apiRouter.post('/question15', (req, res) => { ...@@ -106,13 +105,16 @@ apiRouter.post('/question15', (req, res) => {
106 105
107 apiRouter.post('/question16', (req, res) => { 106 apiRouter.post('/question16', (req, res) => {
108 var userId = req.body.userRequest.user.id; 107 var userId = req.body.userRequest.user.id;
109 - var mesg = req.body.userRequest; 108 + var mesg = req.body.userRequest.utterance;
110 var mbti = ''; 109 var mbti = '';
111 if (mesg == "왜ㅠㅠ무슨일 있었어?") { 110 if (mesg == "왜ㅠㅠ무슨일 있었어?") {
112 mbti = 'F'; 111 mbti = 'F';
113 } else if (mesg == "어떤 기종샀어?") { 112 } else if (mesg == "어떤 기종샀어?") {
114 mbti = 'T'; 113 mbti = 'T';
115 } 114 }
115 + console.log(mbti);
116 + userDB[userId][2] += mbti;
117 + console.log(userDB[userId]);
116 const responseBody = { 118 const responseBody = {
117 version: "2.0", 119 version: "2.0",
118 template: { 120 template: {
...@@ -144,13 +146,16 @@ apiRouter.post('/question16', (req, res) => { ...@@ -144,13 +146,16 @@ apiRouter.post('/question16', (req, res) => {
144 146
145 apiRouter.post('/question17', (req, res) => { 147 apiRouter.post('/question17', (req, res) => {
146 var userId = req.body.userRequest.user.id; 148 var userId = req.body.userRequest.user.id;
147 - var mesg = req.body.userRequest; 149 + var mesg = req.body.userRequest.utterance;
148 var mbti = ''; 150 var mbti = '';
149 if (mesg == "네") { 151 if (mesg == "네") {
150 mbti = 'J'; 152 mbti = 'J';
151 } else if (mesg == "아니오") { 153 } else if (mesg == "아니오") {
152 mbti = 'P'; 154 mbti = 'P';
153 } 155 }
156 + console.log(mbti);
157 + userDB[userId][3] += mbti;
158 + console.log(userDB[userId]);
154 const responseBody = { 159 const responseBody = {
155 version: "2.0", 160 version: "2.0",
156 template: { 161 template: {
...@@ -182,13 +187,16 @@ apiRouter.post('/question17', (req, res) => { ...@@ -182,13 +187,16 @@ apiRouter.post('/question17', (req, res) => {
182 187
183 apiRouter.post('/question18', (req, res) => { 188 apiRouter.post('/question18', (req, res) => {
184 var userId = req.body.userRequest.user.id; 189 var userId = req.body.userRequest.user.id;
185 - var mesg = req.body.userRequest; 190 + var mesg = req.body.userRequest.utterance;
186 var mbti = ''; 191 var mbti = '';
187 if (mesg == "네") { 192 if (mesg == "네") {
188 mbti = 'I'; 193 mbti = 'I';
189 } else if (mesg == "아니오") { 194 } else if (mesg == "아니오") {
190 mbti = 'E'; 195 mbti = 'E';
191 } 196 }
197 + console.log(mbti);
198 + userDB[userId][0] += mbti;
199 + console.log(userDB[userId]);
192 const responseBody = { 200 const responseBody = {
193 version: "2.0", 201 version: "2.0",
194 template: { 202 template: {
...@@ -220,13 +228,16 @@ apiRouter.post('/question18', (req, res) => { ...@@ -220,13 +228,16 @@ apiRouter.post('/question18', (req, res) => {
220 228
221 apiRouter.post('/question19', (req, res) => { 229 apiRouter.post('/question19', (req, res) => {
222 var userId = req.body.userRequest.user.id; 230 var userId = req.body.userRequest.user.id;
223 - var mesg = req.body.userRequest; 231 + var mesg = req.body.userRequest.utterance;
224 var mbti = ''; 232 var mbti = '';
225 if (mesg == "네") { 233 if (mesg == "네") {
226 mbti = 'N'; 234 mbti = 'N';
227 } else if (mesg == "아니오") { 235 } else if (mesg == "아니오") {
228 mbti = 'S'; 236 mbti = 'S';
229 } 237 }
238 + console.log(mbti);
239 + userDB[userId][1] += mbti;
240 + console.log(userDB[userId]);
230 const responseBody = { 241 const responseBody = {
231 version: "2.0", 242 version: "2.0",
232 template: { 243 template: {
...@@ -256,6 +267,7 @@ apiRouter.post('/question19', (req, res) => { ...@@ -256,6 +267,7 @@ apiRouter.post('/question19', (req, res) => {
256 res.status(200).send(responseBody); 267 res.status(200).send(responseBody);
257 }); 268 });
258 269
270 +
259 apiRouter.post('/result', (req, res) => { 271 apiRouter.post('/result', (req, res) => {
260 var userId = req.body.userRequest.user.id; 272 var userId = req.body.userRequest.user.id;
261 var mesg = req.body.userRequest.utterance; 273 var mesg = req.body.userRequest.utterance;
...@@ -266,8 +278,7 @@ apiRouter.post('/result', (req, res) => { ...@@ -266,8 +278,7 @@ apiRouter.post('/result', (req, res) => {
266 } else if (mesg == "아니오") { 278 } else if (mesg == "아니오") {
267 mbti = 'P'; 279 mbti = 'P';
268 } 280 }
269 - userDB[userId] += mbti; 281 +
270 - console.log(userDB[userId]);
271 const responseBody = { 282 const responseBody = {
272 version: "2.0", 283 version: "2.0",
273 template: { 284 template: {
......