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

feat: export packaging data #8359

Merged
merged 3 commits into from
Apr 25, 2023
Merged

feat: export packaging data #8359

merged 3 commits into from
Apr 25, 2023

Conversation

stephanegigandet
Copy link
Contributor

This PR is needed to export packagings data from the producers platform to the public platform.

@stephanegigandet stephanegigandet requested a review from a team as a code owner April 25, 2023 11:18
@github-actions github-actions bot added Data import 🧽 Data quality https://wiki.openfoodfacts.org/Quality export 🏭 Producers Platform https://wiki.openfoodfacts.org/Platform_for_producers 🧪 tests labels Apr 25, 2023
Copy link
Member

@alexgarel alexgarel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but a comment to add, if possible.

{
$j++;
if (defined $packaging_ref->{$field}) {
my $field_sort_key = sprintf("%08d", $group_number * 1000 + $i * 10 + $j);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add a comment to explain this $field_sort_key ?
(also above).

also why don't you use $field_sort_key . "_$j" like on line 272 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a comment a bit above:

		# %populated_fields will contain the field name as the key,
		# and a sort key as the value so that the CSV columns are in the order of $options{import_export_fields_groups}
		my %populated_fields = ();

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll add another comment for packagings:


									# Generate a sort key so that the packaging fields in the CSV file are in this order:
									# - all fields for packaging component 1, then all fields for packaging component 2
									# - number_of_units, shape, material etc. (same a for loop above)

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@stephanegigandet stephanegigandet merged commit da04b19 into main Apr 25, 2023
@stephanegigandet stephanegigandet deleted the export-packagings branch April 25, 2023 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Data import 🧽 Data quality https://wiki.openfoodfacts.org/Quality export 🏭 Producers Platform https://wiki.openfoodfacts.org/Platform_for_producers 🧪 tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants