Skip to content

Commit

Permalink
fix search result duplicated
Browse files Browse the repository at this point in the history
  • Loading branch information
hjlarry committed Dec 31, 2023
1 parent 8b1396a commit f675e92
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion flaskshop/public/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

def get_item_data(item):
return {
"id": item.id,
"meta": {"id": item.id},
"title": item.title,
"description": item.description,
"first_img": item.first_img,
Expand Down Expand Up @@ -110,6 +110,7 @@ def __init__(self, page, per_page, **kwargs):

def _query_items(self):
for item in self.rs:
item.id = item.meta.id
item.first_img = ProductImage.query.filter(ProductImage.product_id == item.id).first()
return self.rs

Expand Down

0 comments on commit f675e92

Please sign in to comment.