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
Fix for populatedb and currency issue #3512
Fix for populatedb and currency issue #3512
Conversation
@stephenmoloney I like the changes, however I think we could move it directly to the methods affected. Eg. and |
5d2831e
to
41a9b57
Compare
Any ideas to overcome this error - I'm not familiar with python types |
b7101dd
to
b016c1a
Compare
Codecov Report
@@ Coverage Diff @@
## master #3512 +/- ##
=======================================
Coverage 89.83% 89.83%
=======================================
Files 250 250
Lines 13217 13217
Branches 1338 1338
=======================================
Hits 11874 11874
Misses 930 930
Partials 413 413 Continue to review full report at Codecov.
|
b016c1a
to
ebec671
Compare
I think I sorted this - disregard ! @Pacu2 I'm getting this error now: https://travis-ci.org/mirumee/saleor/jobs/471870324#L1493 I think I sorted this - disregard ! |
624b95e
to
a416588
Compare
3253f76
to
4e1773f
Compare
@Pacu2 Is there anything more you want done in this PR ? |
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.
Hey, sorry for the late review, I didn't merge this PR yet because I think this function is a bit overcomplicated. I left a few comments. These are small changes but would greatly improve the readability.
43a97c1
to
62e3186
Compare
What does this commit/MR/PR do? - Changes the currency of the demo objects to the default currency Why is this commit/MR/PR needed? - So that populateDB doesn't break due to incorrect currency
62e3186
to
eaa4924
Compare
@@ -183,6 +183,8 @@ def create_products(products_data, placeholder_dir, create_images): | |||
defaults['weight'] = get_weight(defaults['weight']) | |||
defaults['category_id'] = defaults.pop('category') | |||
defaults['product_type_id'] = defaults.pop('product_type') | |||
defaults['price'] = get_in_default_currency( |
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.
Why do this workaround instead of fixing how defaults are generated?
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.
It would be good if the defaults were generated with the right currency - they seem to be coming from a static json file. Right now I've only got time and sufficient python to offer this workaround.
Yea - it's static json - no generation involved. https://github.com/mirumee/saleor/blob/11f30e13551069299a97e73b65f086a920cf63ec/saleor/core/utils/random_data.py#L210
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.
Exactly, this data is coming from db.json
which has USD
currency hardcoded. I think this is an acceptable solution for now. If we have a better idea I'd like to have it described in this PR or a new issue.
What does this commit/MR/PR do?
Why is this commit/MR/PR needed?
Relevant issues:
#3511
Pull Request Checklist