Skip to content
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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

LaurenCovington
Copy link

No description provided.

Copy link

@kaidamasaki kaidamasaki left a 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

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:

Suggested change
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

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.)

Comment on lines +133 to +142
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."

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:

Suggested change
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)

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.)

Comment on lines +146 to +147
def check_in(self):
pass

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:

Suggested change
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()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants