Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Product sync: use default field values instead of None #518

Closed
raphodn opened this issue Oct 13, 2024 · 1 comment · Fixed by #519
Closed

Product sync: use default field values instead of None #518

raphodn opened this issue Oct 13, 2024 · 1 comment · Fixed by #519

Comments

@raphodn
Copy link
Member

raphodn commented Oct 13, 2024

What

During the OxF daily sync, we create (or update) each product.
The input data is not always consistent, for instance some fields are sometimes missing. In that case, we currently set the field value to None.

We should rather skip that field, and let the model decide its default value.

Why

@raphodn
Copy link
Member Author

raphodn commented Oct 13, 2024

Script to fix the Product array fields default values (list instead of None)

for f in Product.ARRAY_FIELDS:
    print(f)
    print(Product.objects.filter(**{f: None}).count())
    Product.objects.filter(**{f: None}).update(**{f: list()})

Script to delete duplicate prices (and proofs)

https://github.com/openfoodfacts/open-prices/wiki/Useful-scripts#delete-duplicate-prices

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
1 participant