-
-
Notifications
You must be signed in to change notification settings - Fork 359
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
chore: add script to gather organization data daily #10447
chore: add script to gather organization data daily #10447
Conversation
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #10447 +/- ##
==========================================
- Coverage 49.54% 49.51% -0.04%
==========================================
Files 67 75 +8
Lines 20650 21573 +923
Branches 4980 5175 +195
==========================================
+ Hits 10231 10681 +450
- Misses 9131 9582 +451
- Partials 1288 1310 +22 ☔ View full report in Codecov by Sentry. |
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.
Great, that's going in the right direction.
'_id' => '$owner', | ||
'number_of_products' => {'$sum' => 1}, | ||
'number_of_data_quality_errors' => { | ||
'$sum' => {'$size' => '$data_quality_errors_tags'} |
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.
in my dev account, I got this error when running the script:
MongoDB::DatabaseError: The argument to $size must be an array, but was of type: missing
Can you check that the array exist before calling $size? There is an example here: https://www.mongodb.com/docs/manual/reference/operator/aggregation/size/#example
(same for other array below)
'$cond' => [{'$in' => ['en:nutriscore-not-computed', '$misc_tags']}, 1, 0] | ||
} | ||
}, | ||
'opportunities_to_improve_nutriscore' => { |
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.
This field is only available on the pro platform, so I think we should run this script on the pro platform.
Can you also add the number of products with states_tags = en:exported , and states_tags = en:to-be-exported ?
] | ||
)->next; | ||
|
||
my $number_of_products = $org_data->{number_of_products} // 0; |
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.
In another PR, we will need to make another query for number_of_products, but on the public platform, in order to get the number of products from the pro platform that have been exported to the pro platform.
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.
Thanks
What
I added a script to the scripts/migrations folder, this script fetches organzaition products based on the product owner id.