Hi and welcome to team Replicant. We have extended our platform functionality to include grocery inventory management. We buy and sell only the finest goods. Unfortunately, our goods are constantly degrading in quality as they approach their sell by date. We have a system in place that updates our inventory for us. Your task is to add a new feature to our system.
First an introduction to our system:
- All items have a
expiryvalue which denotes the number of days we have to sell the item - All items have a
qualityvalue which denotes how valuable the item is - At the end of each day our system lowers both values for every item
Our system lowers the values for expiry and quality in the following ways:
- Once the
expirydate has passed,qualitydegrades twice as fast - The
qualityof an item is never negative - The
qualityof an item is never more than 25 - "Cheddar Cheese" actually increases in
qualitythe older it gets - "Instant Ramen", never has to be sold or decreases in
quality
We have recently signed a supplier of organic items. Your task is to add this feature to the system. This requires the following updates:
- "Organic" items degrade in
qualitytwice as fast as normal items - Once ANY item is 5 days past its
expirydate we can no longer sell it and it should be removed from our system
Your objectives for this challenge:
- We are looking to see how your technical approach considers these two themes:
- Adding functionality that aligns with the spec posted above
- Improving old/ugly code to be be more readable, maintainable and testable
- Unit testing is important to us so we have included Python's unit testing framework.
- You don't have to know everything! We encourage using AI to help you.
- We're not interested in how fast you can code. Take as much time as you need to ensure your submission reflects your best work.
- If you find you're out of time, please note anything you wanted to do and how you would have done it. Please be as descriptive as possible.