-
-
Notifications
You must be signed in to change notification settings - Fork 383
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: launch the exports for all organizations that have the checkbox… #10561
Changes from 3 commits
a1b7314
6107e25
b2d3f18
cd9f850
54e98a0
fa6c942
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,30 +4,48 @@ | |
|
||
export PERL5LIB="lib:${PERL5LIB}" | ||
|
||
PRODUCERS=( | ||
org-barilla-france-sa | ||
org-ferrero-france-commerciale | ||
org-unilever-france-gms | ||
org-unilever-france-rhd | ||
org-nestle-france | ||
org-panzani-sa | ||
org-cristalco | ||
org-materne | ||
org-garofalo-france | ||
org-brasseries-kronenbourg | ||
org-carrefour | ||
org-lustucru-frais | ||
org-nestle-waters | ||
org-kambly | ||
org-kambly-france | ||
org-saint-hubert | ||
org-d-aucy | ||
org-lea-nature | ||
org-auchan-apaw | ||
org-les-mousquetaires | ||
) | ||
|
||
for producer in ${PRODUCERS[@]} | ||
filter_organizations_that_have_automated_export() { | ||
perl -e ' | ||
use strict; | ||
use warnings; | ||
use ProductOpener::Data qw/get_orgs_collection/; | ||
|
||
my %producers = map { $_,1 } qw( | ||
org-barilla-france-sa | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We probably should remove the hardcoded values, and ensure all those orgs have the checkbox checked There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. But I'm not an admin so I can't see the checkbox in the platform. |
||
org-ferrero-france-commerciale | ||
org-unilever-france-gms | ||
org-unilever-france-rhd | ||
org-nestle-france | ||
org-panzani-sa | ||
org-cristalco | ||
org-materne | ||
org-garofalo-france | ||
org-brasseries-kronenbourg | ||
org-carrefour | ||
org-lustucru-frais | ||
org-nestle-waters | ||
org-kambly | ||
org-kambly-france | ||
org-saint-hubert | ||
org-d-aucy | ||
org-lea-nature | ||
org-auchan-apaw | ||
org-les-mousquetaires | ||
); | ||
|
||
my @res = get_orgs_collection() | ||
->find({ activate_automated_daily_export_to_public_platform => "on" }) | ||
->fields({ org_id => 1 }) | ||
->all; | ||
|
||
$producers{"org-" . $_->{org_id}} = undef for @res; | ||
|
||
print "$_\n" for keys %producers; | ||
|
||
' | ||
} | ||
|
||
for producer in $(filter_organizations_that_have_automated_export) | ||
do | ||
scripts/export_and_import_to_public_database.pl --query states_tags=en:to-be-exported --owner $producer | ||
done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shan't we leverage having orgs in MongoDB now and just make a mongoDB request (you can even user mongo client) to get all orgs with activate_automated_daily_export_to_public_platform on ?
cc: @stephanegigandet
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yes I forgot, sure we can do that.
openfoodfacts-server/scripts/export_producers_platform_data_to_public_database.sh
Lines 36 to 39 in b2d3f18