From 50eb7f937234264ad0d73986339eb6dbe96a1d50 Mon Sep 17 00:00:00 2001 From: seo5220 Date: Fri, 19 May 2023 17:07:37 +0900 Subject: [PATCH 1/2] =?UTF-8?q?dm.=20country=5Fname=20=EB=B0=9B=EC=95=84?= =?UTF-8?q?=EC=98=A4=EB=8A=94=20=EA=B2=83=EC=9C=BC=EB=A1=9C=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DM/app.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/DM/app.py b/DM/app.py index bea89f7..4ba4575 100644 --- a/DM/app.py +++ b/DM/app.py @@ -132,11 +132,15 @@ def getCountry(): def getCompanion(): # get 파라미터 user_id = request.args['user_id'] - country_id = int(request.args['country_id']) - + country_name = request.args['country_name'] db = Database() + sql = f'select id from country where name="{country_name}"' + res = db.select(sql) + country_id = int(res[0][0]) + + # Content기반 예측평점 계산 with open('data.pickle', 'rb') as f: content_similarities = pickle.load(f) From 4796d54cf3130068305f334b43f5cfbfc8a65dcb Mon Sep 17 00:00:00 2001 From: seo5220 Date: Fri, 19 May 2023 17:16:52 +0900 Subject: [PATCH 2/2] =?UTF-8?q?dm.=20=ED=98=BC=EC=84=B1,=20=EB=8F=99?= =?UTF-8?q?=EC=84=B1=20=EC=84=A0=ED=83=9D=EC=95=88=ED=95=B4=EB=8F=84=20app?= =?UTF-8?q?end=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DM/app.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/DM/app.py b/DM/app.py index 4ba4575..77bd829 100644 --- a/DM/app.py +++ b/DM/app.py @@ -132,14 +132,10 @@ def getCountry(): def getCompanion(): # get 파라미터 user_id = request.args['user_id'] - country_name = request.args['country_name'] + country_id = int(request.args['country_id']) - db = Database() - - sql = f'select id from country where name="{country_name}"' - res = db.select(sql) - country_id = int(res[0][0]) + db = Database() # Content기반 예측평점 계산 with open('data.pickle', 'rb') as f: @@ -289,7 +285,7 @@ def getCompanion(): # 혼성으로 설정했으면 제외 include_index = list() for idx in companion_index[1:]: - if user_data_gender[user_index][0] == '혼성': + if user_data_gender[user_index][0] == '혼성' or len(user_data_gender[user_index][0]) == 0: if user_data_gender[idx][0] == '혼성': include_index.append(idx) elif user_data_gender[user_index][1] == user_data_gender[idx][1]: # 성이 같을때만