-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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 #1637
base: master
Are you sure you want to change the base?
Solution #1637
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 project! 😊 While your implementation of the Car
and CarWashStation
classes is mostly on point, there are a couple of critical issues that need to be addressed before we can approve the pull request:
-
Incorrect Logic for Average Rating Calculation: The current logic for updating
average_rating
by simply adding 0.1 is incorrect. To accurately update the average rating with a new rating, you should use the formula:new_average = ((old_average * count_of_ratings) + new_rating) / (count_of_ratings + 1)
. This will ensure that the average reflects all ratings received. -
Unused Parameter in
rate_service
Method: Therate_service
method is called with a fixed rating of 5, but this rating is not utilized within the method. Please ensure that the parameteri
is used to update theaverage_rating
based on the new rating provided.
Once these issues are resolved, your code will be in great shape! Keep up the good work, and don't hesitate to reach out if you need any help. 🚀
✨ 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/main.py
Outdated
def rate_service(self, i: int) -> None: | ||
self.average_rating = round( | ||
((self.average_rating * self.count_of_ratings) | ||
+ i) / (self.count_of_ratings + 1), | ||
1) | ||
self.count_of_ratings += 1 |
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
is a bad variable name, it is not clear.
app/main.py
Outdated
if car.clean_mark < self.clean_power: | ||
income += self.calculate_washing_price(car) | ||
self.wash_single_car(car) | ||
self.rate_service(5) |
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.
why you need this line here?
app/main.py
Outdated
self.average_rating = average_rating | ||
self.count_of_ratings = count_of_ratings | ||
|
||
def serve_cars(self, cars: list) -> float: |
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.
def serve_cars(self, cars: list) -> float: | |
def serve_cars(self, cars: list[Car]) -> float: |
Здравствуйте.
Подскажите пожалуйста правильную работу метода rate_service и зачем нужен аргумент?
Спасибо