-
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
Solution #1750
base: master
Are you sure you want to change the base?
Solution #1750
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 pull request! 😊 However, there are a few critical issues that need to be addressed to meet the task requirements:
-
Static Method Requirement: The
sell_product
method in theCinemaBar
class should be defined as a static method. Currently, it is not, which is a core requirement. -
Method Calls in
movie_session
: Themovie_session
method in theCinemaHall
class incorrectly callsCustomer.watch_movie()
andCleaner.clean_hall()
without using instances. You need to iterate over thecustomers
list and callwatch_movie
on eachCustomer
instance, and callclean_hall
on theCleaner
instance. -
Incorrect Method Usage in
cinema_visit
: Thesell_product
method should be called as a static method, not on an instance ofCinemaBar
. Additionally, themovie_session
method is called with incorrect parameters; it should receive a list ofCustomer
instances and aCleaner
instance. -
Parameter Type: The
customers
parameter should be a list ofCustomer
instances, not a single instance. Update the parameter type and iterate over this list to callwatch_movie
on each customer.
These changes are necessary to ensure the code functions correctly and meets the task requirements. Once these issues are resolved, your code will be in great shape! Keep up the good work, and feel free to reach out if you have any questions or 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.
app/cinema/hall.py
Outdated
def __init__(self, number: int): | ||
self.number = number | ||
|
||
def movie_session(self, movie_name: str, customers: Customer, cleaning_staff: 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 customers
parameter should be a list of Customer
instances, not a single Customer
instance. Update the parameter type to List[Customer]
and iterate over this list to call watch_movie
on each customer.
app/cinema/hall.py
Outdated
|
||
def movie_session(self, movie_name: str, customers: Customer, cleaning_staff: Cleaner): | ||
print(f"{movie_name} started in hall number {self.number}.") | ||
Customer.watch_movie() |
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 method watch_movie
should be called on each Customer
instance, not on the Customer
class. Iterate over the customers
list and call customer.watch_movie(movie_name)
for each customer.
app/cinema/hall.py
Outdated
print(f"{movie_name} started in hall number {self.number}.") | ||
Customer.watch_movie() | ||
print(f"{movie_name} ended.") | ||
Cleaner.clean_hall(self.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 method clean_hall
should be called on the cleaning_staff
instance, not on the Cleaner
class. Use cleaning_staff.clean_hall(self.number)
instead.
app/main.py
Outdated
for element in customers: | ||
result_list.append(Customer(element["name"], element["food"])) | ||
for customer in result_list: | ||
CinemaBar.sell_product(customer.food, 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 sell_product
method should be called as a static method of CinemaBar
, not as an instance method. Use CinemaBar().sell_product(customer.food, customer)
instead.
app/main.py
Outdated
for customer in result_list: | ||
CinemaBar.sell_product(customer.food, customer) | ||
for element in result_list: | ||
CinemaHall.movie_session(movie, element.name, 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 movie_session
method should be called with a list of Customer
instances and a Cleaner
instance. Update the call to CinemaHall(hall_number).movie_session(movie, result_list, Cleaner(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.
Great effort on your submission! 🎉 While your code has some issues, such as the sell_product
method in the CinemaBar
class needing to be defined and called as a static method, it's important to address these to meet the task requirements. The cinema_visit
function also needs adjustment to call sell_product
correctly. These changes are crucial for the functionality of your code. Remember, addressing these issues will help you improve and learn. Keep up the good work, and don't hesitate to review the comments to enhance your code further. You're on the right track! 🚀
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
|
||
class CinemaBar: | ||
|
||
def sell_product(self, product: str, customer: Customer) -> 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.
The sell_product
method should be defined as a static method. You can do this by using the @staticmethod
decorator above the method definition. This change is necessary to meet the task requirement that specifies sell_product
should be a static method.
result_list.append(Customer(element["name"], element["food"])) | ||
cinema_bar = CinemaBar() | ||
for customer in result_list: | ||
cinema_bar.sell_product(customer.food, 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 sell_product
method should be called as a static method. Instead of using cinema_bar.sell_product(...)
, you should call it using CinemaBar.sell_product(...)
. This change is necessary to align with the task requirement that specifies sell_product
should be a static method.
No description provided.