You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The scripts/update_all_products.pl script is used to make updates to products (such as reprocessing the ingredients, recomputing scores etc.) without creating a new revision of the product. The product is updated "in place".
This code:
# Otherwise, we silently update the .sto file of the last version
else {
# make sure nutrient values are numbers
ProductOpener::Products::make_sure_numbers_are_stored_as_numbers($product_ref);
if (!$mongodb_to_mongodb) {
# Store data to .sto file
store("$data_root/products/$path/product.sto", $product_ref);
}
# Store data to mongodb
# Make sure product _id and code are saved as string and not a number
# see bug #1077 - https://github.com/openfoodfacts/openfoodfacts-server/issues/1077
# make sure that code is saved as a string, otherwise mongodb saves it as number, and leading 0s are removed
$product_ref->{_id} .= '';
$product_ref->{code} .= '';
$products_collection->replace_one({"_id" => $product_ref->{_id}}, $product_ref, { upsert => 1 });
}
Desired solution
Could be refactored and made into a new function in lib/ProductOpener/Products.pm , that we could call update_existing_product_without_creating_a_new_revision()
Similar code also exists in other scripts like scanbot.pl
Alternatives you have considered
No response
Additional context
No response
Number of products impacted
No response
Time per product
No response
The text was updated successfully, but these errors were encountered:
Problem description
The scripts/update_all_products.pl script is used to make updates to products (such as reprocessing the ingredients, recomputing scores etc.) without creating a new revision of the product. The product is updated "in place".
This code:
Desired solution
Could be refactored and made into a new function in lib/ProductOpener/Products.pm , that we could call update_existing_product_without_creating_a_new_revision()
Similar code also exists in other scripts like scanbot.pl
Alternatives you have considered
No response
Additional context
No response
Number of products impacted
No response
Time per product
No response
The text was updated successfully, but these errors were encountered: