-
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
car #1628
base: master
Are you sure you want to change the base?
car #1628
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 correct, there are a few critical issues that need to be addressed to meet the core requirements of the task:
-
Missing Method: The
CarWashStation
class is missing thewash_single_car
method. This method is essential as it should wash a single car by setting itsclean_mark
to the wash station'sclean_power
if thewash_station.clean_power
is greater thancar.clean_mark
. Please add this method to fulfill the task requirements. -
serve_cars
Method: Ensure that theserve_cars
method utilizes thecalculate_washing_price
method to determine the washing price for each car. This will help maintain consistency and promote code reuse. -
rate_service
Method: Make sure that therate_service
method checks if thenum
parameter is within a valid range (e.g., 1 to 5) before updating the average rating. This will prevent invalid ratings from affecting the average.
Once these issues are addressed, your code will be much stronger and aligned with the task requirements. Keep up the great work, and I'm confident you'll nail it! 🚀
✨ 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
if car.clean_mark < self.clean_power: | ||
income += car.comfort_class * (self.clean_power - car.clean_mark) * self.average_rating / self.distance_from_city_center |
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.
In the serve_cars
method, you should use the calculate_washing_price
method to determine the washing price for each car instead of recalculating it manually. This will ensure consistency and reuse of code.
app/main.py
Outdated
return 0 | ||
|
||
def rate_service(self, num: int): | ||
self.average_rating = round(((self.count_of_ratings * self.average_rating + num) / (self.count_of_ratings + 1)), 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.
In the rate_service
method, ensure that the num
parameter is within the valid range (e.g., 1 to 5) before updating the average rating. This will prevent invalid ratings from affecting 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.
Review Summary
🎉 Great job on implementing the Car
and CarWashStation
classes! Your code meets the task requirements and constraints as specified. Here are some highlights and feedback:
-
Car Class: You've correctly implemented the
Car
class with the necessary attributes:comfort_class
,clean_mark
, andbrand
. -
CarWashStation Class: The
CarWashStation
class is well-implemented with the required attributes:distance_from_city_center
,clean_power
,average_rating
, andcount_of_ratings
. -
serve_cars Method: This method effectively washes cars with a
clean_mark
less thanclean_power
and calculates the income using thecalculate_washing_price
method. -
calculate_washing_price Method: The washing price is calculated accurately using the car's comfort class, the difference between the wash station's clean power and the car's clean mark, the station's average rating, and the distance from the city center.
-
wash_single_car Method: You've correctly updated the car's
clean_mark
to the wash station'sclean_power
when necessary. -
rate_service Method: This method updates the average rating and count of ratings correctly, ensuring the
num
parameter is within a valid range (1 to 5).
Your code aligns well with the task requirements, and no further changes are necessary. However, always strive to review and refine your code. If there are any issues, make sure to address them in future projects to enhance your coding skills. Keep up the great work and continue learning from each experience! 🚀
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
No description provided.