Pizza Truck is an Order Management System for a pizza restaurant. It runs on a mock terminal deployed to Heroku.
The purpose of this program is to manage the user ordering process from beginnng to end. It uses the input provided by the user to build the order and manipulate the data accordingly.
-
As a restaurant owner I want:
- A system that helps me manage the orders.
- That all the options on the menu are displayed to the users.
- Users cannot order something that is not in the displayed options.
- The order price is calclated correctly.
-
As a user I want:
- That the system is easy to use and provides clear instructions.
- See all the available options.
- Being able to personalize my order.
- Being able to check and modify my order before placing it.
- That the price is calculated correctly.
To develop a program that answers all the needs identified above, I have created the following flow chart:
When the program is launched the user is presented with the main menu. This menu works as landing page for the user that can decide if proceed, with the order or exit the program.
The program follows the same pattern at each stages: 1- provides information 2- presents choice of actions/options to the user 3- Receives the number corresponding to the user choice as input
The user's input is validated to confirm that it corresponds to a valid option. All the inputs are validated through the same function, which accepts two parameters: 1- The value that needs to be validated, and 2- The array of options. This second parameter is passed to confirm if the value is in the range of valid options.
To make the user experience more enjoyable the program displays only the valid actions. This means that some options are hidden if they are not relevant. In particular, if there are no items in the basket, the option to view the order and to remove items will be hidden.
The pizzas are managed from a separate file, to keep them more maintainable. We can add new pizzas creating new instances of the class "Pizza". They are then added to the pizza_menu list
This way we can update the menu just in one place, and every time we need to display the available pizza we will display the correct and updated data.
The user can add pizzas to the order by selecting the related option. It will show the available pizza by retrieving the data from the same pizza_menu list, so that the displayed option are automatically updated when the pizza menu is updated.
This time the options are displayed as a short list. The user can go back to the menu if they want to consult the ingredients and prices and update their order at any time.
The user can create a custom pizza by selecting the option "Make your own". The user will choose one option for the dough and one option for the sauce, from the available options.
For the toppings the user can choose up to 4 toppings.
For this reason the total of toppings is displayed to the user each time, so that they can see how many tippings they have left to select.
If there is at least one item in the order, the seller can review the current order. This option will display the added pizza, grouped by type, and the price total and subtotals. This page displays the ingredients only for the custom pizzas, so that the user can see if they have made the wrong choice of ingredients and eventually delete the pizza and create it from scratch.
From this page the user can choose to edit the order, or to place it and exit the program
If the user added he wrong pizzas they have the option to remove them.
This option displays a short list of the pizzas currently in the order, grouped by type, and the total count for each type. The user just needs to select the option number corresponding to the pizza they want to remove.
The view is updated each time, so that the user can see which pizzas are left in the order.
When the user is ready to place the order they can click on the view order, to access the basket, and then select place order to finish.
This will display the final receipt with the total price and a confirmation that the order was made.
General
Action | Expected behavious | Pass / Fail |
---|---|---|
Open the link in the browser | It opens the mock terminal and load the introduction | Pass |
Check the options | "View current order" is not available because there are no items in the order | Pass |
Enter 2 | The goodbye message is displayed and the program stops | Pass |
Click "Run Program" | The program starts again and shows the grretings | Pass |
Enter a letter | A message informs us that it is an invalid value | Pass |
Enter a number which is not an integer | A message informs us that it is an invalid value | Pass |
Enter a integer outside the range of options | A message informs us that it is an invalid value | Pass |
Enter 1 | The terminal shows the order options | Pass |
Check the options | "Remove pizza" and "View current order" are not available because there are no items in the order | Pass |
Enter several invalid values | A message informs us that it is an invalid value | Pass |
Enter 1 | The pizza menu is printed on the terminal | Pass |
Enter 2 | The available pizzas are displayed and we are asked to enter the desired pizza number | Pass |
Add a pizza
Action | Expected behavious | Pass / Fail |
---|---|---|
Enter several invalid values | A message informs us that it is an invalid value | Pass |
Enter all values between 1 and 4 | The corresponding pizza is added to the order and we see a message to confirm it | Pass |
Enter 5 | The program asks to choose the dough type | Pass |
Enter an invalid value | A message informs us that it is an invalid value | Pass |
Enter a valid value | A message confirms the choice and the program asks to choose the sauce | Pass |
Enter an invalid value again | A message informs us that it is an invalid value | Pass |
Enter a valid value | A message confirms the choice and the program asks to choose the toppings | Pass |
Enter an invalid value again | A message informs us that it is an invalid value. The toppings count doesn't change | Pass |
Enter a valid value | The toppings count increases | Pass |
Add 4 toppings | The program confirms the toppings that we entered and asks us to add another pizza | Pass |
Enter 0 | The program shows how many pizzas were added to the order and the order options | Pass |
Other
Action | Expected behavious | Pass / Fail |
---|---|---|
Check the options | Because there are items in the order we see the "View order" and "Remove pizza option" | Pass |
Enter 3 | The program shows the pizzas chosen by the user and the relative count | Pass |
Enter an invalid value | A message informs us that it is an invalid value | Pass |
Enter the number corresponding to one of the options | The program shows the updated count | Pass |
Enter 0 | The program shows the order options | Pass |
Enter 4 | The program shows the order summary with the correct pizzas and the basket option | Pass |
Enter 1 | The order options are displayed again and the user can edit the order | Pass |
Enter 4 | Return to current order view | Pass |
Enter 2 | The program shows the receipt and it exits the program | Pass |
The PEP8 online website is not available at this point. For this reason I installed pycodestyle to my development environment (Visual Code studio), and fixed all the problems encountered during all stages of development.
I also used the new Code Institute linter to validate the code, and it also has not detected any issue.
-
ValueError message not working.
While validating the user input I wanted to display two different messages, dependng on the issue found: 1- Confirm if the user enter an integer (ValueError) 2- Confirm if the integer corresponds to a valid action or if it is out of range (IndexError) The second check was raising the correct error message, but the ValueError was returning a different message, not allowing the user to understand why the input was invalid.
To fix this error I split the checks in two different steps: 1- Check if the user entered a numeric input, if not raise the ValueError 2- If there is no ValueError we convert the input into integer, and we check if it is in range, if not we raise the IndexError -
Remove_pizza removing more than 1 pizza at a time
When removing the pizza, if there were multiple pizza of the same type one after the other, the function was removing more than one at a time.
To fix this bug I added a break keyword to remove only 1 item at a time -
Show_current_order not showing custom pizzas
When printing the current order the custom pizzas added to the order were not displaying. This was caused by the fact the each custom pizza added to the order is a different object from the custom pizza in manu.
To fix this bug I changed the list from where the pizza types are taken. First I create a new list with each type of pizza actually added to the order, then I count how many times each one of this pizzas appears in the order.This fix was showing the custom pizzas, although they were still separate objects, so custom pizzas with same ingredients were actually displayed separately.
To improve this functionality I wanted to display custom pizzas with same ingredients in the same line. To accomplish this result I created a new list of dictionaries, one for each pizza in the order, and than counted their recurrency.
-
Choose_toppings counting invalid input
When choosing the toppings for the custom pizza there is a limit of 4 ingredients, but the function was increasing the count also when an invalid input was entered.
To fix this bug I change the type of iteration, and choose a while loop.
- There are no known unfixed bugs.
The live version of this program is available on Heroku.
- To deply this project on Heroku I followed these steps:
- Create an Heroku accoun
- Click on Add App
- Go to Settings > Config Vars
- Add the config KEY and VALUE provided by Code Institute, in order to be able to use the template provided for this project
- Click on add buildpack to add python and nodejs
- Go to deploy tab
- Select GitHub as deploy method
- Select the relevant GitHub repository
- Click on deploy branch
- For a local deployment follow these steps:
- Create a new directory on your machine, where you want do deploy the files
- Open the existing repository in GitHub
- Go to the "Code" tab
- Click on the "Code" button
- Copy the HTTPS link
- Open your terminal and run the command git clone 'link'
- use the link just copied, without quotes, instead of 'link'
-
For this project I used the "Code Institute student template" required for deploying my third portfolio project (the Python command-line project).
-
The code to display the intro message as typewriter was taken from the Learn Learn Scratch Tutorial
-
The code to clear the terminal was taken from the following article on Stackoverflow
- Python
- sys - needed in the type_write function to simulate typewriter
- time - needed to set the chars printing time in the type_write
- sleep - needed at the end of the program to delay the termination
- os - needed in the function to clear the terminal
- copy - needed to copy the custom instance of pizza, and not overwrite it every time we create a custom pizza
- tabulate - to display the data as table
A special thank to my mentor Dick Vlaanderen for his precious feedback on this project.