Skip to content

Commit

Permalink
Increase performance on find_existing_attribute_option_group query
Browse files Browse the repository at this point in the history
When trying to create alot of options this is really slow
  • Loading branch information
viggo-devries committed Mar 21, 2024
1 parent f24ef46 commit 1afce42
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions oscarapi/utils/exists.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,8 @@ def find_existing_attribute_option_group(name, options):
AttributeOptionGroup.objects.filter(name=name)
.annotate(options_count=models.Count("options"))
.filter(options_count=len(options))
.filter(options__option__in=option)
)
for option in options:
query = query.filter(options__option=option)

try:
return query.get()
Expand Down

0 comments on commit 1afce42

Please sign in to comment.