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 #672

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

solution #672

wants to merge 3 commits into from

Conversation

NazarSlavych
Copy link

No description provided.

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 Pull Request! There are a few critical issues that need to be addressed before we can approve it. The most important one is the incorrect update of the customer's location after the trip home, which affects the logic of the trip cost calculation. Additionally, ensure that the total cost and printed values are rounded to two decimal places as required. Lastly, consider using the current date and time for the receipt to enhance its realism. Once these issues are resolved, your code will be in great shape! Keep up the great work! 😊

✨ 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
Comment on lines 65 to 66
customer.money -= trip_home_cost
customer.move_to(customer.location)

Choose a reason for hiding this comment

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

The customer's location is incorrectly updated to their current location after the trip home. You should update it to their original home location instead. This is a critical issue as it affects the logic of the trip cost calculation.

app/main.py Outdated
Comment on lines 39 to 40
print(f"{customer.name}'s trip to "
f"the {shop.name} costs {total_cost}")

Choose a reason for hiding this comment

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

Ensure that the printed total cost is rounded to two decimal places as required by the task description .

app/shop.py Outdated
Comment on lines 25 to 27
specific_time = datetime(2021, 4, 1, 12, 33, 41)
receipt = [
f"Date: {specific_time.strftime("%m/%d/%Y %H:%M:%S")}",

Choose a reason for hiding this comment

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

The date in the receipt is hardcoded to a specific time. Consider using the current date and time to make the receipt more dynamic and realistic.


total_cost = int(total_cost) if total_cost.is_integer() \
else round(total_cost, 1)
receipt.append(f"Total cost is {total_cost} dollars")

Choose a reason for hiding this comment

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

Ensure that the total cost is rounded to two decimal places as required by the task description.

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.


Great job on implementing the solution! 🎉 Your code meets most of the task requirements and constraints, and it's structured well with the use of classes and modules. Here are some points to consider for improvement:

  1. Customer's Location Update: Ensure that the customer's location is correctly updated after the trip home. Store the original location before moving to the shop and use it to update the customer's location after the trip.

  2. Rounding Logic: Make sure that all financial calculations, including total_cost and formatted_cost, are rounded to two decimal places. This will ensure consistency with the task requirements for financial calculations.

  3. Output Consistency: Ensure that the customer's remaining money and total cost are rounded to two decimal places when printed. This will help maintain consistency in the output format.

Your code is on the right track, and these adjustments will help you refine it further. Keep up the good work, and make sure to address these points in future projects to enhance your coding skills. Happy coding! 😊

✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨

Comment on lines +65 to +67
original_location = customer.location
customer.money -= trip_home_cost
customer.move_to(original_location)

Choose a reason for hiding this comment

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

The customer's location is not correctly updated after the trip home. You should store the original location before moving to the shop and use it to update the customer's location after the trip home.

Comment on lines +39 to +40
print(f"{customer.name}'s trip to "
f"the {shop.name} costs {round(total_cost, 2)}")

Choose a reason for hiding this comment

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

Ensure that the total cost is rounded to two decimal places when printed. This is important for maintaining consistency in the output format.

customer.move_to(original_location)

print(f"{customer.name} rides home")
print(f"{customer.name} now has {customer.money} dollars\n")

Choose a reason for hiding this comment

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

Ensure that the customer's remaining money is rounded to two decimal places when printed. This will help maintain consistency in the output format.

Comment on lines +35 to +37
formatted_cost = int(cost) \
if cost.is_integer() \
else round(cost, 1)

Choose a reason for hiding this comment

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

The rounding logic for formatted_cost should ensure that costs are rounded to two decimal places, not one. This will maintain consistency with the task requirements for financial calculations.

Comment on lines +42 to +43
total_cost = int(total_cost) if total_cost.is_integer() \
else round(total_cost, 1)

Choose a reason for hiding this comment

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

The rounding logic for total_cost should ensure that costs are rounded to two decimal places, not one. This will maintain consistency with the task requirements for financial calculations.

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.

2 participants