File tree Expand file tree Collapse file tree
src/solesearch_api/tasks/db Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -67,19 +67,19 @@ def create_or_update_sneaker(
6767 existing_links = {
6868 link .platform : link .url for link in existing_sneaker .links
6969 }
70- for platform , link in sneaker .links . items () :
71- if existing_links .get (platform ) == link .url :
70+ for new_link in sneaker .links :
71+ if existing_links .get (new_link . platform ) != new_link .url :
7272 logfire .warning (
73- f"{ sneaker .brand } SKU '{ sneaker .sku } ' already has a link for { platform } " ,
73+ f"{ sneaker .brand } SKU '{ sneaker .sku } ' already has a link for { new_link . platform } " ,
7474 sneaker_id = existing_sneaker .id ,
7575 sneaker_sku = sneaker .sku ,
7676 sneaker_brand = sneaker .brand ,
77- existing_link = existing_links [platform ],
78- new_link = link .url ,
77+ existing_link = existing_links [new_link . platform ],
78+ new_link = new_link .url ,
7979 )
8080 else :
81- link .sneaker = existing_sneaker
82- existing_sneaker .links .append (link )
81+ new_link .sneaker = existing_sneaker
82+ existing_sneaker .links .append (new_link )
8383
8484 # Add any new images
8585 existing_image_urls = {image .url for image in existing_sneaker .images }
You can’t perform that action at this time.
0 commit comments