The Scoop is a Python terminal application which runs in the Code Institute mock terminal on Heroku.
Cara McAvinchey
- The Scoop is an app built for an ice cream truck so that customers can easily place an order and collect their items with an order number. The business owner will be able to see how many orders of a single flavour were made for each scoop type and customers can see how much their order will be at the end of the process.
You can view the deployed website here
-
First the customer is welcomed to the app and asked for their name. If valid, the customer and make their first order.
-
If their name input is not valid, the customer will get a hint about what is wrong.
-
The menu displayed will ask for the number of scoops.
-
The app will then ask the customer if they'd like to order another ice cream.
- If no, the customer will receive notice that their order is complete and the price of the order is displayed.
- The customer can proceed to the collection point to pay and pick up their order according to the number.
- The business owner can reflect on the sales of the day when looking at the data sheet here
Welcome Function - An introduction to the company and the service offered with a friendly hello and welcome. There is no terminal interaction at this point.
User Information - The customer is requested their name and the input will be validated for numbers, characters or single letters. - The validate_name function is triggered according to the following if statements:
Ordering Function - The customer will then input their order using numbers. The function will repeat the order again if anything other than the numbers are input.
Reorder Function - After each ice cream is ordered, the customer is given the option to order another or continue to the next step.
Order Successful - The function will add the numbers to an external spreadsheet for the business owner to get total sales orders.
Print Receipt - The customer will see a summary of their order and the final price. The function calculates the number of each scoop ordered and outputs the cost.
Order Complete - The function will generate a random number from 1-100 for the customer to take to the counter and pay/pick up their order when ready.
- For future development, the app could allow for a login/sign up function to collect basic info about The Scoop customer for a possible rewards program e.g for every 5 double scoops, get a single scoop free. (the registration function can be found in the flow chart here
- The Scoop is a growing business, as the product offering increases (such as toppings, cone/cup, flavours) these options could be added to the app and tallied in the spreadsheet for research into which products are most popular.
- If the customer makes a mistake, adding the ability to remove an order would improve the user experience.
- For the business owner, being able to see the sales for the day can assist with stock and reducing waste.
The below flowchart maps out the user experience from beginning to end. The registration process is marked off as a future feature and explained in detail here. Due to time constraints and my limited knowledge, I was not able to code this part of the project.
To better group the ordering functions as an object, I wrote a class representing its properties:
The spreadsheet to be updated after an order is complete:
-
cachetools
- Python module which provides various memoizing collections and decorators.
-
google-auth
- This library simplifies using Google’s various server-to-server authentication mechanisms to access Google APIs.
-
google-auth-oauthlib
- This library provides oauthlib integration with google-auth.
-
gspread
- Interface for working with Google Sheets.
-
oauthlib
- A generic, spec-compliant, thorough implementation of the OAuth request-signing logic for Python 3.6+.
-
pyasn1
- Pure-Python implementation of ASN.1 types and DER/BER/CER codecs (X.208)
-
pyasn1-modules
- A collection of ASN.1 modules expressed in form of pyasn1 classes. Includes protocols PDUs definition (SNMP, LDAP etc.) and various data structures (X.509, PKCS etc.).
-
requests-oauthlib
- Provides first-class OAuth library support for Requests.
-
rsa
- It supports encryption and decryption, signing and verifying signatures, and key generation according to PKCS#1 version 1.5.
No errors reported from PEP8 validator:
- You can view manual testing checklist and record of the application here.
- This is an example of how testing was done below:
- The validation for the reorder function here was tricky to fix but resolved using a third if statement.
- The data being sent to the spreadsheet was displaying incorrectly here.
- This happened when multiple items were ordered e.g. 2 x single scoops, 3 double scoops.
- I tried updating each cell on it's own using the cell reference, then attempted to add to column 1, 2 etc.
- In the end, my mentor helped me to append the array to the row and the issue was resolved.
- There are no outstanding defects.
Before deploying, the Gitpod workspace needs the following setup steps for Heroku to build the project:
- Install the dependencies for Heroku using the following instruction to the terminal:
pip3 freeze > requirements.txt
- The project creds.json file from the Google Drive and Google Sheets API access used when adding Config Var, see example below:
This application will be deployed via Heroku
-
Log into Heroku.
-
Navigate to Dashboard.
-
Click "New" and select "Create New app" from the drop-down menu. Name the application something unique and select your region.
-
Click "Create App".
-
Navigate to "Settings" and scroll down to "config vars".
-
Click "Reveal Config Var", in the field key enter CREDS and in the value field copy and paste the contents of creds.json file.
- Scroll down to "build packs", click "build packs" and then click both "python" and "node.js" ensuring python is first on the list.
-
Navigate to the "Deploy" section.
-
Scroll down to "Deployment Method" and select "GitHub".
-
Authorise the connection of Heroku to GitHub.
-
Search for the GitHub repository name to connect with and select it.
-
For Deployment there are two options, automatic deployment or manual. I chose Automatic Deployment so Heroku will re-build each time code is pushed to GitHub.
-
Ensure the correct branch is selected "master/Main", and select the deployment method that you desire.
- Force the first deployment by clicking 'deploy branch' and wait for the site to build.
- Ensure the build was successful by checking the overview tab and the activity log should say 'Build succeeded'
- Open the deployed site and check that the program is running.
-
Code Institute: Love Sandwiches Project
- Code Institute Template
- The Template for the GUI for this project was provided by Code Institute. This allows for the Command line to be shown and used within the browser.
- Steps to declare and connect the Google APIs to my worksheet.
- Function to update the worksheet.
- Steps to deploy the project to Heroku.
-
Dog's in the Hood by Obiageli Onyekpe
- Deployment section steps in README.
- Libraries section used and descriptions in README.
-
Flowchart created using diagrams.net
-
Articles:
- This GeeksforGeeks article helped with creating the order number function.
- Displaying the correct currency was achieved with the help of this article.
-
Thanks to my mentor, Malia Havlicek for reviewing and giving suggestions on how to improve my project.
-
The tutors at Code Institute for their patience and support.
-
The Code Institute Slack community for tips and guidance.