Skip to content
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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Solution #1637

wants to merge 4 commits into from

Conversation

dimakherson74
Copy link

Здравствуйте.
Подскажите пожалуйста правильную работу метода rate_service и зачем нужен аргумент?
Спасибо

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a 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:

  1. 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.

  2. Unused Parameter in rate_service Method: The rate_service method is called with a fixed rating of 5, but this rating is not utilized within the method. Please ensure that the parameter i is used to update the average_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 Show resolved Hide resolved
app/main.py Outdated Show resolved Hide resolved
app/main.py Outdated
Comment on lines 36 to 41
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
Copy link

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)
Copy link

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:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def serve_cars(self, cars: list) -> float:
def serve_cars(self, cars: list[Car]) -> float:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants