Skip to content
Snippets Groups Projects
Verified Commit 6a4a5c7e authored by Eunhak Lee's avatar Eunhak Lee
Browse files

hotfix: combination 의 존재 여부 확인할 때 part id는 정렬된 상태여야 함

parent fa62b657
No related branches found
No related tags found
No related merge requests found
Pipeline #10974 passed
...@@ -60,10 +60,6 @@ def handle_single_part(_dict, part_type): ...@@ -60,10 +60,6 @@ def handle_single_part(_dict, part_type):
return None return None
name = _dict["name"] name = _dict["name"]
if part_type == 'GPU':
name = name.replace("GeForce", "").replace("NVIDIA", "")
matched_parts = check_similarity(db_conn, name, part_type) matched_parts = check_similarity(db_conn, name, part_type)
if not matched_parts: if not matched_parts:
...@@ -102,7 +98,7 @@ def check_if_parts_exist(_cursor, _user_id, _part_ids): ...@@ -102,7 +98,7 @@ def check_if_parts_exist(_cursor, _user_id, _part_ids):
sql = """WITH result AS (SELECT combinations.id AS combination_id, sql = """WITH result AS (SELECT combinations.id AS combination_id,
ARRAY(SELECT part_id FROM relations WHERE relations.combination_id = combinations.id ORDER BY relations.part_id) AS parts ARRAY(SELECT part_id FROM relations WHERE relations.combination_id = combinations.id ORDER BY relations.part_id) AS parts
FROM combinations WHERE combinations.owner_id = %s) SELECT combination_id FROM result WHERE parts = %s;""" FROM combinations WHERE combinations.owner_id = %s) SELECT combination_id FROM result WHERE parts = %s;"""
sql = _cursor.mogrify(sql, (_user_id, _part_ids)) sql = _cursor.mogrify(sql, (_user_id, sorted(_part_ids)))
logger.debug(sql) logger.debug(sql)
_cursor.execute(sql) _cursor.execute(sql)
data = _cursor.fetchall() data = _cursor.fetchall()
...@@ -220,7 +216,6 @@ def func(): ...@@ -220,7 +216,6 @@ def func():
_combination_id = None _combination_id = None
# 이미 존재하는 경우 # 이미 존재하는 경우
if not _created_parts:
logger.info("Checking combination existance") logger.info("Checking combination existance")
with db_conn.cursor() as cursor: with db_conn.cursor() as cursor:
_combination_id = check_if_parts_exist(cursor, _user_id, _part_ids) _combination_id = check_if_parts_exist(cursor, _user_id, _part_ids)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment