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

Out of stock forecasting #25

Merged
merged 5 commits into from
Feb 25, 2017
Merged

Conversation

kjagiello
Copy link
Member

Predict, based on recent sales, when a product will run out of stock.

@kjagiello kjagiello added this to the 2.0.0 milestone Feb 22, 2017
@kjagiello kjagiello self-assigned this Feb 22, 2017
@kjagiello kjagiello force-pushed the feature/out-of-stock-forecast branch from fa60ac5 to 212ec8c Compare February 22, 2017 23:02
@codecov
Copy link

codecov bot commented Feb 22, 2017

Codecov Report

Merging #25 into develop will increase coverage by 0.16%.
The diff coverage is 93.02%.

@@             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
Impacted Files Coverage Δ
src/shop/models.py 84.07% <100%> (+0.1%)
src/shop/querysets.py 91.66% <100%> (+1.66%)
src/shop/api.py 92.15% <100%> (+2.32%)
src/shop/tests/test_api.py 100% <100%> (ø)
src/shop/admin.py 58.17% <50%> (-0.72%)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4e7bd10...ea8fa2c. Read the comment docs.

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
Copy link
Member

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.


@mock.patch('shop.api.predict_quantity')
def test_update_quantity_prediction(self, predict_quantity_mock):
product_obj = factories.ProductFactory.create()
Copy link
Member

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.

(-5, datetime(2016, 11, 15, 0)),
(+5, datetime(2016, 11, 15, 0)),
]
product_obj = factories.ProductFactory.create()
Copy link
Member

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.
Copy link
Member

@flaeppe flaeppe Feb 23, 2017

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

@kjagiello
Copy link
Member Author

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

@kjagiello
Copy link
Member Author

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.

@kjagiello kjagiello merged commit df2168d into develop Feb 25, 2017
@kjagiello kjagiello deleted the feature/out-of-stock-forecast branch March 12, 2017 18:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants