- User Experience/User Interface
- Design
- Features
- Testing
- Technology
- Deployment
- Credits
- Acknowledgement
As a first time user I want:
- The user to have a warm welcome.
- The user to have a clear idea of the ordering system.
- The ordering system to function properly and ordering system to be intuitive.
- The user can understand what the ordering system is about just from its name.
- The user to know the rules of the ordering system.
- The system gives the user a hint as to whether to enter number or letters
As a return or frequent user I want:
- To be able to be be acknowledged by the system.
- The system to display the last order
As a owner of the game, I want:
- The user to know how to order from the main screen.
- The user to be given the option to order multiple subs.
When it comes to building and designing a project, the first question that comes to my mind is, what am I going to build? when I googled for ideas it gave me millions of options and ideas that I could do. Games like tic tac toe, hangman, battleship, guess the number, and building a calculator are great options. I thought of making a hangman game. When I started building hangman, I found myself to be uninspired. The code for this game was easily available on the internet and i found myself searching for the answers rather than thinking for myself. This is when I said I need to build something by myself. I need to sweat my brain because that's the only way to learn something. That is when I came with the idea of building this project. The project calls an API to send and receive the data and it then manipulates this data to display the required information to the user.
Basic design of the game was built using the lucidchart website. The logic of the game was implemented in the chart. Once I was satisfied with the logic, I started to code. I tried not to use too many colors so that the terminal would not look messy. The colors used are as follows:
- Green - for user inputs
- White - Most of the text
- Red - Whenever the code handled an error and throws an information to the user.
There are a lot of features in this website and they are as follows -
-
The user can enter their last name and the name should be more than two characters and less than 25 characters.
-
The terminal throws a message to the user when -
-
The user receives a warm welcome by saying "Welcome to My-Sub My-Way Username"
-
When user is asked to choose either footlong or six inch, the user has only option to type 'a' or 'b'.
-
The terminal throws a message to the user when -
-
The user is asked to choose what type of bread he/she would like to have.
-
The terminal throws a message to the user when -
-
The same error pops up for most of the ordering system
-
The user is limited to choose vegetables only six time.
-
The user is limited to choose only three sauces rather than choosing all the sauces.
-
Once the order is complete, the ordering system calculates the price and asks the user if they would like to have 15% off their bill.
-
If the user select 'y', the system calculates the bill by taking off 15% off the price.
-
The Receipt is Printed in the end which gives all the details of the order.
-
Once the order is complete the user is asked if he/she would to order again.
One of the best features of this system is that, if the username exist in the system, it asks the user if he/she would like to view the last receipt. It always shows the last receipt.
-
The app imports data by calling an API that is saved in the google spreadsheet. gspread module is used to fetch data.
-
Any information given by the user while using this app, is saved in the google spreadsheet. The app calls for an API and receives the data from there. Sample image of of user information is in the image below.
Testing was done using the PEP8 Online.
- Copy and paste code from run.py file to PEP8 Online checker.
- Hit the check code button and it shows if you have any error or not.
In my case NO ERROR was found and it says ALL RIGHT
Automatic Testing was done using pytest frameworks.
-
A file named test.py is added.
-
Install pytest by the following command in the terminal
pip3 install pytest
-
Import pytest in the module.
-
Each function is named by test_** so that the pytest framework knows that this exact function to be tested.
-
Each function is checked and tested by test.py module.
-
Where there is nothing returned by any of the functions in run.py and the function checks for user input, @pytest.fixture is added which provides a dummy input to check if the code is working properly.
-
To check, if the tests were successful, just run the code in the terminal and it says 12 passed in 0.01s (in my case)
python3 -m pytest test.py
-
All the tests ran successfully without error. The image below -
- Python
- GitPod was used as an online IDE.
- GitHub was used for version control and to save the app online.
- Heroku was used to deploy the site.
- os
- sys
os and sys was used to restart the ordering system.
- gspread
gspread was used to fetch user information and other details from google spreadsheet.
- google.oauth2.service_account
- Credentials
Details of Users were saved in google spreadsheet.
- time
time was used to generate time for every order.
- random
random was used to generate a random receipt number.
- prettytable
prettytable was used to put all the details in table format.
- art
art was used to print the logo of the site.
- colorama
colorama was used to add color to text.
Gitpod was used to make this project. I used Code Institute's Template for this project
- Click on Code Institute's Template and then click on use this template button.
- Write the name of the project, select on PUBLIC and click Create Repository from template.
- Click on the green Gitpod button and gitpod will start loading. Once Gitpod is loaded, you are ready to code.
- Each time you write and save your code you do the following -
- git add .
- git commit -m "your message"
- git push
Each term explained below
.git add adds all your last saved codes to your repository.
git commit -m "your message" A clear short message explaining the updates.
git push To push all the recent changes and make it live on the page.
-
Navigate to Google Cloud Platform
-
Create a free account(if you don't have an account) by clicking 'Get Started for Free' button in the upper right corner.
-
Once the account is created, click on the Create New Project with a name of your choice.
-
Head over to the hamburger menu and click 'Library' and select API followed by Services.
-
Search Google Drive API and enable it.
-
Search Google Sheet API and enable it.
-
In the top left, click Create credentials and select Google drive from the dropdown menu.
-
Select Application Data.
-
Select NO, I'm Not.
-
Click Next.
-
Enter the Service Account name (the name for your chosen project).
-
Click create and continue.
-
In the Role Dropdown box select Basic and click continue.
-
On the next page click Done.
-
Click on the service account that has been created and navigate to the Keys Tab
-
Click on Add Key and select Create New Key.
-
Select JSON and click Create. This will download the File on you machine.
-
From you local machine, add the downloaded file to gitpod and rename it to creds.json.
-
Open creds.json and copy the value for client's email.
-
Go to google sheet and click share, paste the email address, make sure to assign the role as Editor.
- Enable the API
-
Within the gitpod terminal enter the following code 'pip3 install gspread google-auth'
-
Adding the code(the image below) in the gitpod enable to talk with the google spreadsheet.
-
Navigate to the github Repository.
-
Click on the drop down menu CODE.
-
Click on Download Zip and run locally on your machine or copy GIT URL from the HTTPS link.
-
Open your favorite IDE or editor and open the terminal.
-
Change the current working directory to the location where you want the cloned directory.
-
Use the 'git clone' command and paste the copied git URL.
-
Press enter to create clone on your device.
Before you deploy to heroku, make sure to add the following code in gitpod to add all the requirements and then do a git push, the code is -
pip3 freeze --local > requirements.txt
-
Navigate to heroku and click sign up to create a new account.
-
Click the New button and click Create New APP.
-
Add a name for app in the APP-Name field.
-
Select your region from the drop down menu and click on Create App button.
-
On the next page click on the Settings tab to adjust the settings.
-
Click on the 'config vars' button.
-
Supply a KEY of PORT and it's value of 8000. Then click on the "add" button.
-
Click on the ADD Build button.
-
Add python buildpack and then node.js. The sequence of adding bulidpack has to correct or else it might not work properly.
-
Navigate to deploy screen, select github and connect to your github profile.
-
Now you can deploy the app automatically or manually. Automatic deploy will update the app automatically every time you push any changes to github.
-
Once the build is successful, you can open the app by clicking Open App button in the top right corner.
A lot of help was taken from all over the internet and the main ones are -
- Stack Overflow
- W3Schools
- FreeCodeCamp
- Tutorialspoint (For Pytest & Fixture)
I would like to thank my tutor, Kasia, and my mentor Ronan, for their invaluable help and guidance throughout the process. The slack group Jan-2022-lwetb, and all the fellow mates from slack.
Thanks to my fellow slackers for reviewing my project and a very special thank you to my mentor Ronan, for his invaluable advice and resources throughout the development of this project. SPECIAL THANKS TO MY WIFE FOR BUYING ME ALL THE TIME IN THE WORLD TO DO THE COURSE AND THE PROJECTS.