-
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 #1609
base: master
Are you sure you want to change the base?
solution #1609
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 implementation! 😊 While your code meets many of the task requirements, there are a couple of critical issues that need to be addressed before we can approve the pull request.
-
Division by Zero: In the
calculate_washing_price
method, there's a potential division by zero error when usingself.distance_from_city_center
as a divisor. Please ensure that this value is checked and handled appropriately to prevent runtime errors. -
Rating Calculation: The
rate_service
method updatestotal_rating
before incrementingcount_of_ratings
, which leads to an incorrect average rating. Make sure to increment the count first to correctly factor in the new rating.
Once these issues are resolved, your code will be in great shape! Keep up the great 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/main.py
Outdated
|
||
def rate_service(self, new_rating: float): | ||
self.count_of_ratings += 1 | ||
total_rating = self.average_rating * (self.count_of_ratings - 1) + new_rating |
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.
Logical error: The total_rating
calculation should occur after incrementing self.count_of_ratings
. Otherwise, the new rating is not properly factored into the average.
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.
Re-request review
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.
review changes
No description provided.