Products are pulled from the right Session but were persisted in the local database linked to the wrong session
Context:
I have multiple Shopify stores. This results in several Session
entries.
Problem:
The Products are pulled from the right Session (store-B
) but were persisted in the local database linked to the wrong session (store-A
)
How to reproduce the error:
1 - Have a newly created database, (just after running the first python manage.py migrate
)
2 - Create two Session
entries in this order:
store-A
store-B
3 - Pull the products of the store store-B
from shopify_sync.models import Session, Product
store_b_session = Session.objects.get(site="store-B")
products = Product.objects.sync_all(session=store_b_session)
first_product = products[0]
print(first_product.session.site)
4 - The output of the print()
command will be store-A
rather than store-B
and this is the bug.
I think that the bug is related to this logic:
I discovered this project today. I'm still learning more about it. Anyway, thank you very much for reactivating this project.
Edited by Fabio Caritas Barrionuevo da Luz