Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
meanspec-hwinfo-daemon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MeanSpec (SCE338 2024-2 Group 1)
meanspec-hwinfo-daemon
Commits
6a4a5c7e
Verified
Commit
6a4a5c7e
authored
6 months ago
by
Eunhak Lee
Browse files
Options
Downloads
Patches
Plain Diff
hotfix: combination 의 존재 여부 확인할 때 part id는 정렬된 상태여야 함
parent
fa62b657
No related branches found
No related tags found
No related merge requests found
Pipeline
#10974
passed
6 months ago
Stage: deploy
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
push_to_db.py
+6
-11
6 additions, 11 deletions
push_to_db.py
with
6 additions
and
11 deletions
push_to_db.py
+
6
−
11
View file @
6a4a5c7e
...
@@ -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
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment