Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 59 additions & 37 deletions lib/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
age_checker
)

tab_open = False

def main():
while True:
enter_bar()

option_select()

#verifies valid choice
Expand All @@ -24,42 +24,48 @@ def get_valid_choice(valid_options):
#entering the bar
def enter_bar():
print("\nPlease select an option:")
print("0. Leave")
print("1. Can I see your ID?")
print("2. Leave")

choice = get_valid_choice(["0", "1"])
if choice == "0":
exit_program()
elif choice == "1":
choice = get_valid_choice(["1", "2"])
if choice == "1":
age_checker()
elif choice == "2":
exit_program()


#main option select
def option_select():
print("\n Options")
print("\nOptions")
#change later to only show if tab is open
print("0. Close Your Tab")
print("1. Can I get a drink?")
#hint for leaving if your tab is open
print("\nhint: to leave, close your tab")
if (tab_open):
print("2. Close Your Tab")
print("\nhint: to leave, close your tab")
else:
print("2. Leave")

choice = get_valid_choice(["0", "1"])
if choice == "0":
close_tab()
elif choice == "1":
choice = get_valid_choice(["1", "2"])
if choice == "1":
select_drink()
elif choice == "2":
if (tab_open):
close_tab()
else:
leave()

#drink selection options
def select_drink():
print("\n Options:")
print("0. Go Back")
print("1. Cosmo")
print("2. Manhattan")
print("3. Tequila Sunrise")
print("4. Rum Runner")
print("5. Bees Knees")
print("6. Go Back")

choice = get_valid_choice(["0", "1", "2", "3", "4", "5"])
if choice == "0":
choice = get_valid_choice(["1", "2", "3", "4", "5", "6"])
if choice == "6":
option_select()
else:
drinks = {
Expand All @@ -70,49 +76,65 @@ def select_drink():
"5": "Bees Knees"
}
print(f"\n{drinks[choice]}, right up!")
open_tab()

if tab_open:
add_to_tab(drinks, choice)
else:
open_tab()


def open_tab():
global tab_open
print("Would you like to open a tab?")
print("0. yes")
print("1. no")
print("y. yes")
print("n. no")

choice = get_valid_choice(["0", "1"])
if choice == "0":
choice = get_valid_choice(["y", "n"])
if choice == "y":
print("Opening tab!")
else:
tab_open = True
elif choice == "n":
print("Here's your total: total")

print("Press enter to continue")
user_input = input()
option_select()

def add_to_tab(drinks, choice):
print(f"Adding {drinks[choice]} to tab!")
option_select()

#shows option to close tab, change later to show up if drinks are added to tab
def close_tab():
print("\n Are you sure?:")
print("0. Yes")
print("1. No")

choice = get_valid_choice(["0", "1"])
if choice == "0":
global tab_open
print("\nAre you sure?:")
print("y. Yes")
print("n. No")

choice = get_valid_choice(["y", "n"])
if choice == "y":
tab_open = False
leave_bar()
elif choice == "1":
elif choice == "n":
option_select()

#leaving the bar
def leave_bar():
#show this if just closing tab
print("\nClosing Tab!")
print(" Would you like to leave?")
print("0. yes")
print("1. no")
option_select()


def leave():
print("Are you sure?")
print("y. yes")
print("n. no")

choice = get_valid_choice(["0", "1"])
if choice == "0":
choice = get_valid_choice(["y", "n"])
if choice == "y":
exit_program()
elif choice == "1":
elif choice == "n":
option_select()


if __name__ == "__main__":
main()
4 changes: 2 additions & 2 deletions lib/debug.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
# lib/debug.py
import ipdb
#import ipdb
from models.Customer import Customer
from models.Drinks import Drinks
from models.Drink_Orders import DrinkOrder
Expand All @@ -19,4 +19,4 @@

Customer.delete_all()
Drinks.delete_all()
ipdb.set_trace()
#ipdb.set_trace()