From 56cc79f0012a917e77eb596de566bee1e6dfe294 Mon Sep 17 00:00:00 2001 From: onisley Date: Sat, 16 Nov 2019 17:15:03 +0900 Subject: [PATCH 1/4] Rename status code --- controller/make_summary.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/controller/make_summary.py b/controller/make_summary.py index 714642a..e8d06fc 100644 --- a/controller/make_summary.py +++ b/controller/make_summary.py @@ -105,7 +105,7 @@ def post(self): print(keywords) return { - 'status': 200, + 'statusCode': 200, 'data': json.dumps({ "keywords": keywords, "contents": contents @@ -115,13 +115,13 @@ def post(self): except Exception as e: print(e) print(traceback.format_exc()) - return {'status': '500', 'message': f'{e}'} + return {'statusCode': '500', 'message': f'{e}'} class TestFlask(Resource): def post(self): try: - return {'status': '200', 'message': 'hello!'} + return {'statusCode': '200', 'message': 'hello!'} except Exception as e: - return {'status': '500', 'message': f'{e}'} + return {'statusCode': '500', 'message': f'{e}'} From 52b9954b298d77dfc8b461ca1c98bd97f0681026 Mon Sep 17 00:00:00 2001 From: onisley Date: Sat, 16 Nov 2019 18:43:24 +0900 Subject: [PATCH 2/4] Modify returns --- controller/make_summary.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/controller/make_summary.py b/controller/make_summary.py index e8d06fc..714642a 100644 --- a/controller/make_summary.py +++ b/controller/make_summary.py @@ -105,7 +105,7 @@ def post(self): print(keywords) return { - 'statusCode': 200, + 'status': 200, 'data': json.dumps({ "keywords": keywords, "contents": contents @@ -115,13 +115,13 @@ def post(self): except Exception as e: print(e) print(traceback.format_exc()) - return {'statusCode': '500', 'message': f'{e}'} + return {'status': '500', 'message': f'{e}'} class TestFlask(Resource): def post(self): try: - return {'statusCode': '200', 'message': 'hello!'} + return {'status': '200', 'message': 'hello!'} except Exception as e: - return {'statusCode': '500', 'message': f'{e}'} + return {'status': '500', 'message': f'{e}'} From 2eb4d121c87c041a64a0dca1449542f8643f08e2 Mon Sep 17 00:00:00 2001 From: onisley Date: Sat, 16 Nov 2019 19:35:28 +0900 Subject: [PATCH 3/4] Add converter --- controller/make_summary.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controller/make_summary.py b/controller/make_summary.py index 714642a..a10ea1d 100644 --- a/controller/make_summary.py +++ b/controller/make_summary.py @@ -98,7 +98,7 @@ def post(self): for word_val in keywords: total_to_convert += word_val["value"] for word_val in keywords: - word_val['value'] = int(word_val['value']*(7/total_to_convert) + 8) + word_val['value'] = int((word_val['value']*7)/total_to_convert) + 8 print('==== Conference Log Summary ====') print(contents) From 5a93f2e45ee67e744afba0272620581f2f304918 Mon Sep 17 00:00:00 2001 From: onisley Date: Sat, 16 Nov 2019 21:10:59 +0900 Subject: [PATCH 4/4] Add values --- controller/make_summary.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/controller/make_summary.py b/controller/make_summary.py index a10ea1d..a66eeb3 100644 --- a/controller/make_summary.py +++ b/controller/make_summary.py @@ -99,6 +99,13 @@ def post(self): total_to_convert += word_val["value"] for word_val in keywords: word_val['value'] = int((word_val['value']*7)/total_to_convert) + 8 + count_count = [15, 13, 11] + for word_val in keywords: + if len(count_count) == 0: + break + + word_val['value'] = count_count[0] + count_count.pop(0) print('==== Conference Log Summary ====') print(contents)