-
Notifications
You must be signed in to change notification settings - Fork 72
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
Paper - Lauren Covington #64
base: main
Are you sure you want to change the base?
Conversation
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.
Good job!
While you had some missing functionality you finished the project and this was kind of a rough one.
For next cohort we will definitely clarify guidelines and provide more structure. 😄
title = input("Enter the title of the video you want to work with: ") | ||
print("Video info you selected: ", video_store.get_video(title=title)) | ||
elif choice_param == "id": # address case issue 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.
You can use lower()
to convert the case of the string:
elif choice_param == "id": # address case issue later | |
elif choice_param.lower() == "id": # address case issue later |
Also, if you'd made the case match the prompt it would have been less of an issue (you asked for ID
but only accepted id
).
else: | ||
print("Could not select. Please enter the title or ID of an existing video. ") | ||
elif employee_choice == '9': # NOT WORKING 5/27/21, 8:27pm |
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.
I think you may have been struggling here because you misunderstood the requirements.
The goal was to update the video (the title, quantity, etc) and not to update a rental.
(I'm not sure updating rentals was supported by the API and would be much less straightforward if it was.)
def check_out(self, customer_id=None, video_id=None, check_out_date=None): | ||
relevant_params = { | ||
"customer_id": customer_id, | ||
"video_id": video_id, | ||
"check_out_date": check_out_date | ||
} | ||
if self.selected_customer == None: | ||
return "Could not find a customer by that name or ID." | ||
if self.selected_video == None: | ||
return "Could not find a video by that title or ID." |
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.
To check out a movie all you need is the customer and the video ids.
You can use your selected customer and video for that:
def check_out(self, customer_id=None, video_id=None, check_out_date=None): | |
relevant_params = { | |
"customer_id": customer_id, | |
"video_id": video_id, | |
"check_out_date": check_out_date | |
} | |
if self.selected_customer == None: | |
return "Could not find a customer by that name or ID." | |
if self.selected_video == None: | |
return "Could not find a video by that title or ID." | |
def check_out(self): | |
if self.selected_customer == None: | |
return "Could not find a customer by that name or ID." | |
if self.selected_video == None: | |
return "Could not find a video by that title or ID." | |
relevant_params = { | |
"customer_id": self.selected_customer["id"], | |
"video_id": self.selected_video["id"], | |
} |
"register_at": register_at, | ||
"videos_checked_out_count": videos_checked_out_count | ||
} | ||
response = requests.post(self.url + "/customers", json=relevant_params) |
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.
It's a best practice to check the status code before you use a response. (Even if the API generally gives well formed responses.)
def check_in(self): | ||
pass |
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.
Check in winds up looking very similar to check out:
def check_in(self): | |
pass | |
def check_in(self): | |
if self.selected_customer == None: | |
return "Could not find a customer by that name or ID." | |
if self.selected_video == None: | |
return "Could not find a video by that title or ID." | |
relevant_params = { | |
"customer_id": self.selected_customer["id"], | |
"video_id": self.selected_video["id"], | |
} | |
response = requests.post(self.url + "/rentals/check-in", json=relevant_params) | |
return response.json() |
No description provided.