-
Notifications
You must be signed in to change notification settings - Fork 70
Laurel O Scissors #55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
lolkinetzky
wants to merge
7
commits into
AdaGold:main
Choose a base branch
from
lolkinetzky:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
0ec3cd6
completed requirements 1-5 chck/in/out in works
lolkinetzky 325940b
ah, check in/out works now
lolkinetzky 10cbce8
added customer functions
lolkinetzky 96465c7
smol steps
lolkinetzky d4a4870
added customers not cleaned or tested
lolkinetzky cd5bd9d
all the required actions, not pretty yet
lolkinetzky 93ce69e
purdy colors
lolkinetzky File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,244 @@ | ||
| import requests | ||
| from video_store import Video_store | ||
|
|
||
| URL = "http://127.0.0.1:5000" | ||
| BACKUP_URL = "https://retro-video-store-api.herokuapp.com" | ||
| #URL = "http://localhost:5000" | ||
| URL = "https://retro-video-store-api.herokuapp.com" | ||
|
|
||
| def main(): | ||
| print("WELCOME TO RETRO VIDEO STORE") | ||
| pass | ||
| print(u"\u001b[34;1mWELCOME TO BRICKBUSTER\u001b[0m") | ||
| #pass | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| main() | ||
| main() | ||
|
|
||
| def print_stars(): | ||
|
|
||
| print("______________________________________________________________________") | ||
| print(u"\u001b[41m___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|__") | ||
| print("_|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|") | ||
| print("___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|__") | ||
| print("_|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|\u001b[0m") | ||
|
|
||
|
|
||
| def houston_we(): | ||
| print(" _______ ") | ||
| print(" _________ .----'''' ''''----. ") | ||
| print(" :______.-': : .-----------------. : ") | ||
| print(" | ______ | | : : | ") | ||
| print(" |:______B:| | | Little Error: | | ") | ||
| print(" |:______B:| | | | | ") | ||
| print(" |:______B:| | | Item not | | ") | ||
| print(" | | | | found. | | ") | ||
| print(" |:_____: | | | | | ") | ||
| print(" | == | | : : | ") | ||
| print(" | O | : '-----------------' : ") | ||
| print(" | o | :'-----...______...-----' ") | ||
| print(" | o |-._.-i_____/' \._ ") | ||
| print(" |'-.____o_| '-. '-...______...-' `-._ ") | ||
| print(" :_________: `.____________________ `-.___.-. ") | ||
| print(" .'.eeeeeeeeeeeeeeeeee.'. :___: ") | ||
| print(" fsc .'.eeeeeeeeeeeeeeeeeeeeee.'. ") | ||
| print(" :____________________________: ") | ||
|
|
||
|
|
||
| def list_options(): | ||
| options = { | ||
| "1": "List all videos in stock", | ||
| "2": "Create a new video record", | ||
| "3": "Select a video", | ||
| "4": "Update selected video", | ||
| "5": "Delete selected video", | ||
| "6": "Delete all videos in stock", | ||
| "7": "List all options", | ||
| "8": "Quit", | ||
| "9": "Rent out a video", | ||
| "10": "Return a video", | ||
| "11": "List all customers", | ||
| "12": "Add a new customer", | ||
| "13": "Update selected customer", | ||
| "14": "Delete selected customer", | ||
| "15": "Select a customer" | ||
| } | ||
|
|
||
| print_stars() | ||
| print(u"\u001b[34m Good to see You") | ||
| print(" These are the actions you can perform\u001b[0m") | ||
| print_stars() | ||
| #houston_we() | ||
|
|
||
| for choice_num in options: | ||
| print(f"\u001b[34mOption {choice_num}. {options[choice_num]}\u001b[0m") | ||
|
|
||
| print_stars() | ||
|
|
||
| return options | ||
|
|
||
| def make_choice(options, video_store): | ||
| valid_choices = options.keys() | ||
| choice = None | ||
|
|
||
| while choice not in valid_choices: | ||
| print("What would you like to do? Select 7 to see all options again") | ||
| choice = input("Make your selection using the option number: ") | ||
|
|
||
| if choice in ['4','5'] and video_store.selected_video == None: | ||
| print("You must select a video before updating or deleting it") | ||
| print("Let's select a video!") | ||
| choice = "3" | ||
|
|
||
| elif choice in ['13', '14'] and video_store.selected_customer == None: | ||
| print("You must select a customer before updating or deleting it") | ||
| print("Let's select a customer!") | ||
| choice = "15" | ||
|
|
||
| return choice | ||
|
|
||
| def run_cli(play=True): | ||
|
|
||
| video_store = Video_store(URL) | ||
|
|
||
| options = list_options() | ||
|
|
||
| while play==True: | ||
|
|
||
|
|
||
| choice = make_choice(options, video_store) | ||
|
|
||
| if choice=='1': | ||
| print_stars() | ||
| for video in video_store.list_videos(): | ||
| print(video) | ||
|
|
||
| elif choice=='2': | ||
| print("Great! Let's create a new video.") | ||
| title=input("What is the name of the video? ") | ||
| release_date=input("When was this movie released?") | ||
| total_inventory=input("How many copies of this video are we adding?") | ||
| response = video_store.create_video(title=title, release_date=release_date, total_inventory= total_inventory) | ||
|
|
||
| print_stars() | ||
| print("New video:", response) | ||
|
|
||
| elif choice=='3': | ||
| select_by = input("Would you like to select by? Enter title or id: ") | ||
| if select_by=="title": | ||
| title = input("Which title would you like to select? ") | ||
| video_store.get_video(title=title) | ||
| elif select_by=="id": | ||
| video_id = input("Which video id would you like to select? ") | ||
| if video_id.isnumeric(): | ||
| video_id = int(video_id) | ||
| video_store.get_video(video_id=video_id) | ||
| else: | ||
| print("Could not select. Please enter id or title.") | ||
|
|
||
| if video_store.selected_video: | ||
| print_stars() | ||
| print("Selected video: ", video_store.selected_video) | ||
|
|
||
| elif choice=='4': | ||
| print(f"Great! Let's update the movie: {video_store.selected_video}") | ||
| title=input("What is the title of your new video? ") | ||
| release_date=input("When was it released?") | ||
| total_inventory=input("How many copies do you have available to add to stock?") | ||
| response = video_store.update_video(title=title, release_date=release_date, total_inventory=total_inventory) | ||
|
|
||
| print_stars() | ||
| print("video:", response) | ||
|
|
||
| elif choice=='5': | ||
| video_store.delete_video() | ||
|
|
||
| print_stars() | ||
| print("Movie has been deleted.") | ||
|
|
||
| print_stars() | ||
|
|
||
| elif choice=='6': | ||
| for video in video_store.list_videos(): | ||
| video_store.get_video(video_id=video['id']) | ||
| video_store.delete_video() | ||
|
|
||
| print_stars() | ||
| print("Deleted all videos in stock. Out with the old.") | ||
|
|
||
| elif choice=='7': | ||
| list_options() | ||
|
|
||
| elif choice=='8': | ||
| play=False | ||
| print("\nThanks!") | ||
|
|
||
| elif choice =='9': | ||
| customer_id = input("Which customer is renting today? (please provide customer id)") | ||
| video_id = input("Which video would they like to rent? (please provide video id)" ) | ||
| response = video_store.check_out_video(int(customer_id), int(video_id)) | ||
| if response != 200: | ||
| houston_we() | ||
| print(response) | ||
| print_stars() | ||
|
|
||
| elif choice =='10': | ||
| customer_id = input("Which customer is returning today? (please provide customer id)") | ||
| video_id = input("Which video are they returning? (please provide video id)") | ||
| response = video_store.check_in_video(int(customer_id), int(video_id)) | ||
| print(response) | ||
| print_stars() | ||
|
|
||
|
|
||
| elif choice =='11': | ||
| print_stars() | ||
| for customer in video_store.list_customers(): | ||
| print(customer) | ||
|
|
||
| elif choice =='12': | ||
| print("Great! Let's add a new customer.") | ||
| name=input("What is the name of customer?") | ||
| phone=input("Please add customer's phone number ->") | ||
| postal_code=input("Please add customer's postal code ->") | ||
| response = video_store.create_customer(name=name, phone=phone, postal_code= postal_code) | ||
|
|
||
| print_stars() | ||
| print("New customer:", response) | ||
|
|
||
| elif choice =='13': | ||
| print(f"Great! Let's update the customer {video_store.selected_customer}'s record") | ||
| name=input("What is the new name of customer?") | ||
| phone=input("Please add customer's new phone number ->") | ||
| postal_code=input("Please add customer's new postal code ->") | ||
| response = video_store.update_customer(name=name, phone=phone, postal_code= postal_code) | ||
|
|
||
| print_stars() | ||
| print("Customer:", response) | ||
|
|
||
| elif choice == '14': | ||
| video_store.delete_customer() | ||
|
|
||
| print_stars() | ||
| print("Customer has been deleted.") | ||
|
|
||
| print_stars() | ||
|
|
||
| elif choice == '15': | ||
| select_by = input("Would you like to select your cutomer by? Enter name or id: ") | ||
| if select_by=="name": | ||
| title = input("Which customer would you like to select by name? ") | ||
| video_store.get_customer(customer=customer) | ||
| elif select_by=="id": | ||
| customer_id = input("Which customer id would you like to select? ") | ||
| if customer_id.isnumeric(): | ||
| customer_id = int(customer_id) | ||
| video_store.get_customer(customer_id=customer_id) | ||
| else: | ||
| print("Could not select. Please enter id or name.") | ||
|
|
||
| if video_store.selected_customer: | ||
| print_stars() | ||
| print("Selected customer: ", video_store.selected_customer) | ||
|
|
||
| print_stars() | ||
|
|
||
|
|
||
| run_cli() | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So fun!