Skip to content

Commit

Permalink
Merge branch 'main' into taxonomy_EN_palmeolein
Browse files Browse the repository at this point in the history
  • Loading branch information
benbenben2 authored Mar 24, 2023
2 parents 0985828 + 4668488 commit 1145da0
Show file tree
Hide file tree
Showing 5 changed files with 93 additions and 3 deletions.
32 changes: 32 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,37 @@
# Changelog

## [2.9.0](https://github.com/openfoodfacts/openfoodfacts-server/compare/v2.8.0...v2.9.0) (2023-03-24)


### Features

* Add Perl introductory resources to warm newbies about Perl [#8204](https://github.com/openfoodfacts/openfoodfacts-server/issues/8204) ([#8206](https://github.com/openfoodfacts/openfoodfacts-server/issues/8206)) ([bda3722](https://github.com/openfoodfacts/openfoodfacts-server/commit/bda3722715773c054f90998d010812a31784c525))
* Match synonyms and xx: entries when computing taxonomy suggestions ([#8190](https://github.com/openfoodfacts/openfoodfacts-server/issues/8190)) ([e1304de](https://github.com/openfoodfacts/openfoodfacts-server/commit/e1304de45393305f27ea80da47bcfacf44f6f90f))


### Bug Fixes

* Do not show the lilo prompt in countries where it's unsupported ([#8236](https://github.com/openfoodfacts/openfoodfacts-server/issues/8236)) ([fd4ee43](https://github.com/openfoodfacts/openfoodfacts-server/commit/fd4ee432df4fbca4aa6aad3c090335ad7ea794ee))
* Hide all nutritional related info if no nutritional info on the box is selected ([#8232](https://github.com/openfoodfacts/openfoodfacts-server/issues/8232)) ([4fbae54](https://github.com/openfoodfacts/openfoodfacts-server/commit/4fbae547ded635a6e538d8438349f94d06d3bd11))
* Nutri Score Nutriments with an asterisk ([#8205](https://github.com/openfoodfacts/openfoodfacts-server/issues/8205)) ([4ba6017](https://github.com/openfoodfacts/openfoodfacts-server/commit/4ba601783285261baada45e73af1cc790a40ac16))


### Technical

* add documentation about unselecting photo ([#8237](https://github.com/openfoodfacts/openfoodfacts-server/issues/8237)) ([b989be3](https://github.com/openfoodfacts/openfoodfacts-server/commit/b989be34a057db1c2e6cafb9ae9b0cdb035c6ec2))


### Taxonomy

* added a category ([#8227](https://github.com/openfoodfacts/openfoodfacts-server/issues/8227)) ([412b4a7](https://github.com/openfoodfacts/openfoodfacts-server/commit/412b4a7c78513e9c23c4b957214a3257129b5b8f))
* de syn E306 ([#8229](https://github.com/openfoodfacts/openfoodfacts-server/issues/8229)) ([aeda389](https://github.com/openfoodfacts/openfoodfacts-server/commit/aeda389cd57febcd75ef2d5c77d82f46c7ef48fa))
* Fish preparations ([#8226](https://github.com/openfoodfacts/openfoodfacts-server/issues/8226)) ([cd2f65f](https://github.com/openfoodfacts/openfoodfacts-server/commit/cd2f65fdf9e1c414050c82ebd44a480e5c55af82))
* fix naming hr + taxonomy for mairoluin ([#8239](https://github.com/openfoodfacts/openfoodfacts-server/issues/8239)) ([b5a7994](https://github.com/openfoodfacts/openfoodfacts-server/commit/b5a79942d7f62bdfa4b86ccd045d06e41a0aa21e))
* German ingredient translation ([#8228](https://github.com/openfoodfacts/openfoodfacts-server/issues/8228)) ([7aa497b](https://github.com/openfoodfacts/openfoodfacts-server/commit/7aa497b07d8cf28abc28cbaef0b3cf897debed2e))
* German translation 2 ([#8240](https://github.com/openfoodfacts/openfoodfacts-server/issues/8240)) ([be30c89](https://github.com/openfoodfacts/openfoodfacts-server/commit/be30c8931978f4dec21272fb15a2b5fe664a55ec))
* Mortadella ([#8235](https://github.com/openfoodfacts/openfoodfacts-server/issues/8235)) ([2a89c5d](https://github.com/openfoodfacts/openfoodfacts-server/commit/2a89c5d42b2690aede71fc9a5df1fd94147b5372))
* Update vitamins.txt ([#8230](https://github.com/openfoodfacts/openfoodfacts-server/issues/8230)) ([5286169](https://github.com/openfoodfacts/openfoodfacts-server/commit/5286169264dd2430b03063cacd6f4e0e4566e45e))

## [2.8.0](https://github.com/openfoodfacts/openfoodfacts-server/compare/v2.7.0...v2.8.0) (2023-03-17)


Expand Down
24 changes: 24 additions & 0 deletions lib/ProductOpener/Packaging.pm
Original file line number Diff line number Diff line change
Expand Up @@ -706,6 +706,27 @@ sub migrate_old_number_and_quantity_fields_202211 ($product_ref) {
return;
}

=head2 canonicalize_packaging_components_properties ($product_ref) {
Re-canonicalize the shape, material and recycling properties of packaging components.
This is useful in particular if the corresponding taxonomies have changed.
=cut

sub canonicalize_packaging_components_properties ($product_ref) {

foreach my $packaging_ref (@{$product_ref->{packagings}}) {
foreach my $property ("shape", "material", "recycling") {
if (defined $packaging_ref->{$property}) {
my $tagtype = $packaging_taxonomies{$property};
$packaging_ref->{$property}
= canonicalize_taxonomy_tag($product_ref->{lc}, $tagtype, $packaging_ref->{$property});
}
}
}
return;
}

=head2 set_packaging_misc_tags($product_ref)
Set some tags in the /misc/ facet so that we can track the products that have
Expand Down Expand Up @@ -867,6 +888,9 @@ sub analyze_and_combine_packaging_data ($product_ref, $response_ref) {
# TODO: remove once all products have been migrated
migrate_old_number_and_quantity_fields_202211($product_ref);

# Re-canonicalize the packaging components properties, in case the corresponding taxonomies have changed
canonicalize_packaging_components_properties($product_ref);

# The packaging text field (populated by OCR of the packaging image and/or contributors or producers)
# is used as input only if the packagings structure is empty
if ((scalar @{$product_ref->{packagings}} == 0) and (defined $product_ref->{packaging_text})) {
Expand Down
14 changes: 12 additions & 2 deletions taxonomies/ingredients.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7291,7 +7291,7 @@ ca:mascarpone
cs:mascarpone
cv:Маскарпоне
da:mascarpone
de:Mascarpone
de:Mascarpone, Mascarpone Frischkäse
el:μασκαρπόνε
eo:Maskarpono
es:mascarpone
Expand Down Expand Up @@ -7684,7 +7684,7 @@ cs:Parmezán
cv:Пармиджано Реджано
cy:Caws Parmesan
da:Parmesan, Parmigiano-Reggiano
de:Parmesan, parmigiano reggiano
de:Parmesan, parmigiano reggiano, Parmigiano Reggiano Käse
el:Παρμεζάνα
eo:Parma fromaĝo
es:queso parmesano
Expand Down Expand Up @@ -13031,6 +13031,12 @@ pl:kolagen wołowy
# ingredient/fr:boyau-de-boeuf has 24 products in 4 languages @2019-01-30
# enveloppe:boyau de boeuf

<en:collagen
<en:beef
en:beef collagen
de:Rinderkollagen
fr:collagène de bœuf, collagène de boeuf

<en:collagen
<en:pork
en:pork collagen, pork casing, pork gut
Expand Down Expand Up @@ -29395,6 +29401,9 @@ hu:borsófehérje izolátum
ro:izolat proteic de mazăre

<en:pea protein
en:textured pea protein, textured pea proteins
de:texturiertes Erbseneiweiß
fr:protéines de pois texturées, protéine de pois texturée
hr:teksturiranog proteina graška
ro:texturat proteic de mazăre

Expand Down Expand Up @@ -29517,6 +29526,7 @@ fr:protéines de soja déshydratées
hu:dehidratált szójafehérje

<en:soy protein
en:textured soy protein
cs:texturovaná sojová bílkovina
fr:protéines de soja texturées

Expand Down
24 changes: 24 additions & 0 deletions tests/unit/packaging.t
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,30 @@ foreach my $test_ref (@tests) {
}
}

my $product_ref = {
lc => "fr",
packagings => [
{
shape => 'fr:bouteille',
material => 'en:pet',
recycling => 'à jeter'
},
],
};

ProductOpener::Packaging::canonicalize_packaging_components_properties($product_ref);

is_deeply(
$product_ref->{packagings},
[
{
'material' => 'en:pet-1-polyethylene-terephthalate',
'recycling' => 'en:discard',
'shape' => 'en:bottle'
},
]
) or diag explain $product_ref->{packagings};

#

done_testing();
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.8.0
2.9.0

0 comments on commit 1145da0

Please sign in to comment.