-
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
Implemented Car and CarWashStation classes #1791
base: master
Are you sure you want to change the base?
Conversation
…aging cars and providing car wash services. Added methods for washing cars, calculating service cost, rating the service, and maintaining a list of cars.
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! Your implementation of the Car
and CarWashStation
classes is well-structured and meets most of the task requirements. However, there are a few critical issues that need to be addressed before we can approve the pull request:
-
Error Message for
average_rating
: The error message should be more descriptive to guide users correctly. Consider updating it to something like'Average rating must be between 1 and 5.'
to provide clear feedback. -
Condition for
distance_from_city_center
: The current condition does not allow for a distance of 0, which might be valid if the station is located in the city center. Please adjust the condition to allow a range from 0 to 10. -
Type Hint for
car_list
: The type hint should belist[Car]
instead oflist | Car
. The current hint suggests thatcar_list
could be a singleCar
object or a list, which is likely not the intended usage.
Once these issues are resolved, your code will be in great shape! Keep up the great work, and I look forward to seeing the improvements. 😊
✨ 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
one_car.clean_mark = self.clean_power | ||
return one_car | ||
|
||
def serve_cars(self, car_list: list | Car) -> int: |
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 type hint for car_list
should be list[Car]
instead of list | Car
. The current type hint suggests that car_list
could be a single Car
object or a list, which is likely not the intended usage.
app/main.py
Outdated
def __init__(self, distance_from_city_center: float, | ||
clean_power: int, average_rating: float, | ||
count_of_ratings: int) -> None: | ||
if not (1 <= distance_from_city_center <= 10): |
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 condition for distance_from_city_center
should allow for a range from 0 to 10, not 1 to 10, as a distance of 0 might be valid (e.g., if the station is in the city center).
app/main.py
Outdated
if not (1 <= distance_from_city_center <= 10): | ||
raise ValueError("distance_from_city_center") | ||
if not (1 <= average_rating <= 5): | ||
raise ValueError("average raiting") |
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 error message for average_rating
is incomplete and should be more descriptive, such as 'Average rating must be between 1 and 5.'
…ors. - Updated the valid range of `istance_from_city_center` from 1-10 to 0-10. - Refactored `serve_cars` to eliminate duplicate code by reusing `calculate_washing_price` function.
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 job on implementing the Car
and CarWashStation
classes! 🚗🧼 You've effectively addressed most of the previous feedback, and your code is well-structured. Here are a few points to consider for further improvement:
-
Error Message for
average_rating
: You've updated the error message to'average raiting must be between 1 and 5'
, which is more descriptive. However, ensure the spelling is correct for clarity. -
Type Hint for
car_list
: You've corrected the type hint forcar_list
in theserve_cars
method tolist[Car]
, which is appropriate and enhances code readability.
Overall, your solution meets the task requirements and constraints. Keep up the good work! Remember to review the comments to refine your code further. Addressing these minor issues will help you avoid similar problems in the future and enhance your coding skills. Keep learning and improving! 🌟
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
if not (0 <= distance_from_city_center <= 10): | ||
raise ValueError("distance from city must be between 0 and 10") | ||
if not (1 <= average_rating <= 5): | ||
raise ValueError("average raiting must be between 1 and 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.
The error message for average_rating
should be more descriptive. Consider updating it to 'Average rating must be between 1 and 5.'
to provide clear feedback.
income += round(float(f"{formula: .2f}"), 1) | ||
return income | ||
|
||
def serve_cars(self, car_list: list[Car]) -> int: |
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 type hint for car_list
should be list[Car]
instead of list | Car
to correctly indicate that it is a list of Car
objects.
with functionality for managing cars and providing car wash services. Added methods for washing cars, calculating service cost, rating the service, and maintaining a list of cars.