-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Good #1730
base: master
Are you sure you want to change the base?
Good #1730
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.
Thank you for your hard work on this submission! 😊 While your code meets many of the task requirements, there are a few critical issues that need to be addressed before we can approve it:
-
Logical Error in
sell_product
Method: In theCinemaBar
class, thesell_product
method should use theproduct
parameter directly instead of overwriting it withcustomer.food
. This change is crucial to ensure the correct product is sold. -
Type Mismatch in
movie_session
Method: TheCinemaHall
class'smovie_session
method should accept a list ofCustomer
instances, not a single instance. This adjustment is necessary for the method to handle multiple customers properly. -
Redundant Loop in
cinema_visit
Function: The creation ofCustomer
,Cleaner
, andCinemaHall
instances should occur outside of any loops to avoid unnecessary repetition and inefficiency. -
Incorrect Return Type in
Cleaner
Class: The__init__
andclean_hall
methods should not have return type annotations, or should returnNone
respectively, as they do not return any value.
Please address these issues to ensure your code functions as intended and meets the task requirements. Keep up the great work, and don't hesitate to reach out if you need further assistance! 🚀
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
🔄 Fix the issues, commit the changes, and then re-request my review using the Re-request review
button in the Reviewers tab.
def sell_product(product: str, customer: Customer) -> None: | ||
product = customer.food |
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.
The sell_product
method should use the product
parameter directly instead of overwriting it with customer.food
. This ensures that the method sells the product specified by the caller, not just the food associated with the customer.
def movie_session( | ||
self, | ||
movie_name: str, | ||
customers: Customer, |
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.
The customers
parameter should be a list of Customer
instances, not a single Customer
instance. Update the type hint to list[Customer]
to reflect this.
for i in range(len(customers)): | ||
customer_instance = [Customer(c["name"], c["food"]) for c in customers] | ||
cleaner_instance = Cleaner(cleaner) | ||
hall = CinemaHall(hall_number) |
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.
There is an unnecessary loop when creating instances of Customer
, Cleaner
, and CinemaHall
. The loop should be removed, and the instances should be created outside of the loop. This will ensure that the instances are created only once, not repeatedly.
movie: str | ||
) -> None: | ||
for i in range(len(customers)): | ||
customer_instance = [Customer(c["name"], c["food"]) for c in customers] |
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.
The customer_instance
should be created outside of the loop. The list comprehension is correct, but it should not be inside a loop. Move it outside the loop to create the list of Customer
instances once.
|
||
|
||
class Cleaner: | ||
def __init__(self, name: str) -> Cleaner: |
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.
The __init__
method should not have a return type annotation. Constructors in Python do not return a value, so the -> Cleaner
annotation should be removed.
def __init__(self, name: str) -> Cleaner: | ||
self.name = name | ||
|
||
def clean_hall(self, hall_number: int) -> Cleaner: |
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.
The clean_hall
method should have a return type of None
instead of Cleaner
. Update the return type annotation to -> None
.
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.
Thank you for your submission! 🎉 While your code has made some progress, there are a few critical issues that need attention to fully meet the task requirements:
-
Logical Error in
sell_product
Method: In theCinemaBar
class, ensure that thesell_product
method uses theproduct
parameter directly instead of assigningproduct = customer.food
. This will ensure the correct product is sold. -
Type Mismatch in
movie_session
Method: TheCinemaHall
class'smovie_session
method should accept a list ofCustomer
instances, not a single instance. Update the parameter toList[Customer]
and importList
fromtyping
. -
Redundant Loop in
cinema_visit
Function: Move the creation ofCustomer
,Cleaner
, andCinemaHall
instances outside of any loops to avoid unnecessary repetition and improve efficiency. -
Incorrect Return Type in
Cleaner
Class: The__init__
andclean_hall
methods should not have return type annotations or should be-> None
, as they do not return any value.
These issues are important for the functionality and efficiency of your code. Please review the comments and address these points to improve your solution. Remember, addressing these issues will help you avoid similar problems in the future and enhance your coding skills. Keep up the good work and continue learning from your experiences! 😊
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
|
||
@staticmethod | ||
def sell_product(product: str, customer: Customer) -> None: | ||
product = customer.food |
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.
The line product = customer.food
is incorrect. You should use the product
parameter directly instead of overwriting it with customer.food
. This will ensure the correct product is sold as intended.
def movie_session( | ||
self, | ||
movie_name: str, | ||
customers: Customer, |
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.
The customers
parameter should be a list of Customer
instances, not a single Customer
. Change the type annotation to List[Customer]
and ensure you import List
from typing
.
for i in range(len(customers)): | ||
customer_instance = [Customer(c["name"], c["food"]) for c in customers] | ||
cleaner_instance = Cleaner(cleaner) | ||
hall = CinemaHall(hall_number) |
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.
The creation of customer_instance
, cleaner_instance
, and hall
should be moved outside of the loop. Currently, these instances are being recreated in each iteration, which is inefficient and unnecessary.
|
||
|
||
class Cleaner: | ||
def __init__(self, name: str) -> Cleaner: |
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.
The __init__
method should not have a return type annotation or should be -> None
, as it does not return any value.
def __init__(self, name: str) -> Cleaner: | ||
self.name = name | ||
|
||
def clean_hall(self, hall_number: int) -> Cleaner: |
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.
The clean_hall
method should not have a return type annotation or should be -> None
, as it does not return any value.
No description provided.