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* #5137

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

Solution* #5137

wants to merge 2 commits into from

Conversation

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

Great job on implementing the calculateRentalCost function! 🎉 Your code meets the task requirements and constraints, and you've used descriptive names and constants effectively. However, there is a logical error in the discount application. When the rental period is longer than 7 days, the current implementation does not apply both discounts correctly. To improve your code, consider adjusting the logic to ensure both discounts are applied when applicable.

Additionally, while your test cases are well-structured, there's a logical inconsistency in the expected results for the 7-day rental scenario. Make sure to review and correct these to ensure accurate testing.

Overall, your approach is solid, and with a few adjustments, it will be even better. Keep up the good work, and use this feedback to refine your solution. Remember, addressing these issues will help you avoid similar problems in the future and enhance your learning experience. 🚀

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

Comment on lines +16 to +21
if (days >= LONG_RENT) {
return basePrice - LONG_RENT_DISCOUNT;
}

if (days >= SHORT_RENT) {
return basePrice - SHORT_RENT_DISCOUNT;

Choose a reason for hiding this comment

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

There is a logical error in the discount application. If days is greater than or equal to LONG_RENT, the function returns immediately with the LONG_RENT_DISCOUNT, and the SHORT_RENT_DISCOUNT is never considered. To fix this, you should adjust the logic to apply both discounts correctly when applicable.

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