-
Notifications
You must be signed in to change notification settings - Fork 6
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
Out of stock forecasting #25
Conversation
fa60ac5
to
212ec8c
Compare
Codecov Report
@@ Coverage Diff @@
## develop #25 +/- ##
===========================================
+ Coverage 87.79% 87.96% +0.16%
===========================================
Files 73 73
Lines 2417 2500 +83
Branches 125 134 +9
===========================================
+ Hits 2122 2199 +77
- Misses 277 282 +5
- Partials 18 19 +1
Continue to review full report at Codecov.
|
src/shop/api.py
Outdated
date_offset = trx_objs[0]['date'].toordinal() | ||
|
||
x = [trx_obj['date'].toordinal() - date_offset for trx_obj in trx_objs] | ||
x = [-1] + x |
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.
Add a comment here, because this isn't intuitive as to why we do this.
Just to save time and headache.
src/shop/tests/test_api.py
Outdated
|
||
@mock.patch('shop.api.predict_quantity') | ||
def test_update_quantity_prediction(self, predict_quantity_mock): | ||
product_obj = factories.ProductFactory.create() |
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.
Rename this to product
so we get rid of some of the _
. Helps with readability.
src/shop/tests/test_api.py
Outdated
(-5, datetime(2016, 11, 15, 0)), | ||
(+5, datetime(2016, 11, 15, 0)), | ||
] | ||
product_obj = factories.ProductFactory.create() |
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.
Rename product_obj
to product
, helps with readability
# | y | 100 | 95 | 85 | 83 | 80 | | ||
# +---+-----+----+----+----+----+ | ||
# | ||
# The cryptic code below does just that. |
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.
+1 on commenting. This is the definition of proper documentation
in code
Am I wrong or do we need to take weekends into account? FooBar is namely closed during weekends and currently the system can forecast that a product will run out of stock during a weekend, which will most likely not happen. What can we do about that? @flaeppe |
I think we'll leave it as it is for now and see how it performs in action, then iterate on the idea, if necessary. |
Predict, based on recent sales, when a product will run out of stock.