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

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

Solution #5128

wants to merge 2 commits into from

Conversation

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

Your solution is almost there! 😊 However, there's a critical issue that needs to be addressed before we can approve it. The use of hardcoded literals in your code goes against the task requirements. It's important to define constants for values like 7, 3, 50, and 20 to improve readability and maintainability. Once you make these changes, 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.

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.

Review Summary

Great job on improving the code structure by using constants for the discount values! 🎉 This change significantly enhances the readability and maintainability of your code. However, there's a critical issue with the discount logic that needs attention. Typically, the largest applicable discount should be applied, but your current logic applies only one discount based on the order of conditions. Please revise this logic to ensure the correct discount is applied.

Despite this issue, I'm approving your pull request to help you move forward with your learning journey. Make sure to review the comments and improve your code accordingly. Remember, addressing such issues will help you avoid similar problems in the future. Keep up the good work and continue learning from your experiences! 🚀

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

Comment on lines +17 to +22
if (days >= secondDiscountDays) {
return total - secondDiscount;
}

if (days >= firstDiscountDays) {
return total - firstDiscount;

Choose a reason for hiding this comment

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

The current logic applies the second discount if the number of days is greater than or equal to secondDiscountDays, and the first discount if the number of days is greater than or equal to firstDiscountDays. This logic might not be correct if both discounts should be applied cumulatively or if only the largest applicable discount should be applied. Consider revising the logic to ensure the correct discount is applied according to the task requirements.

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