-
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 #1802
base: master
Are you sure you want to change the base?
Solution #1802
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 and 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:
-
Washing Price Calculation: The method
calculate_washing_price
seems to have an incorrect formula. Please ensure that the logic used for calculating the washing price aligns with the intended functionality. Double-check the use ofself.average_rating / self.distance_from_city_center
to confirm it makes sense for your application. -
Empty Cars List Check: In the
serve_cars
method, it's important to check if the list of cars is not empty before proceeding with the washing process. This will help avoid unnecessary operations and potential errors.
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 guidance. 🚀
✨ 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 calculate_washing_price(self, car: Car) -> float: | ||
return round( | ||
car.comfort_class | ||
* (self.clean_power - car.clean_mark) | ||
* self.average_rating / self.distance_from_city_center, 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.
The calculation of the washing price might not be correct. Ensure that the formula used here aligns with the intended logic for calculating the price. Double-check the use of self.average_rating / self.distance_from_city_center
to ensure it makes sense in the context of your application.
app/main.py
Outdated
def serve_cars(self, cars: list[Car]) -> float: | ||
income = 0 | ||
for car in cars: | ||
income += self.wash_single_car(car) | ||
return round(income, 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.
Consider adding a check to ensure that the cars
list is not empty before proceeding with the washing process. This will prevent unnecessary operations and potential errors.
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.
Sorry, the pull request review was unsuccessful for the following reasons:
Warning
No changes were made in the pull request since the last review. Please make sure that you have added files to the pull request and committed the changes.
[CODE: 7]
If the issue is within your control, please address it.
The next review attempt will automatically launch in 1 hour.
If you believe this is an error or need assistance, please contact the support team.
app/main.py
Outdated
if not cars: | ||
return 0 |
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.
no need for this check
app/main.py
Outdated
income = 0 | ||
if self.clean_power > car.clean_mark: | ||
income += self.calculate_washing_price(car) | ||
car.clean_mark = self.clean_power | ||
return round(income, 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 this method you should change just car clean mark , in serve_cars method you should calculate washing price
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.
Read the comments
Solution for py-car-wash-station