This is a submission for Fetch Rewards Backend Engineer Apprenticeship
For main.py & test.py
- Run test.py
- This will run the unittest for main.py to confirm the results are as expected
For fetch_points_api.py
- Run fetch_points_api.py
- Open the index.html page by clicking the link to your local host on your machine by clicking the link in the terminal or navigate to http://127.0.0.1:5000/ in your browser
- This will run main.py and spend the points per the assignment instructions
- The Balance Results will be displayed at the bottom of the page
- Input transaction information in the format shown in the default values
- Click the "Add Transaction" button to add a new transaction
- This will add the transaction information to a json file
- Continue adding transactions
- After adding the desired number of transactions, Enter the Amount of points available to spend in the
- Click the "Calculate The Balance" button
- This will run the points.py which will pull all the transactions from the json file and spend the number of points listed
- The Transactions that were entered will be displayed on screen in the Transactions Submissions section
- The number of points to spend entered will be displayed on screen in the Total Points to Spend section
- The balance of points calculated per payer will be displayed on screen in the Balance based on Submissions section
Expected Result after spending points
[
{ "payer": "DANNON", "points": -100 },
{ "payer": "UNILEVER", "points": -200 },
{ "payer": "MILLER COORS", "points": -4,700 }
]
Balance Expected Result
{
"DANNON": 1000,
"UNILEVER": 0,
"MILLER COORS": 5300
}