-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
salary #1376
base: master
Are you sure you want to change the base?
salary #1376
Conversation
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! 😊 While your code is well-structured and meets most of the task requirements, there are a couple of critical issues that need to be addressed before we can approve the pull request.
-
Boundary Date Logic: The current logic for checking the date range excludes the boundary dates. This could lead to incorrect salary calculations for employees working on the start or end dates. Please adjust the logic to include these dates.
-
Variable Name Typo: There's a typo in the variable name
hoursLyRate
. It should be corrected tohourlyRate
to ensure clarity and accuracy in your code.
Once these issues are resolved, your code will be in great shape! Keep up the great work, and don't hesitate to reach out if you have any questions. 🚀
✨ 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.
LocalDate workDate = LocalDate.parse(parts[0], formatter); | ||
String employeeName = parts[1]; | ||
int hoursWorked = Integer.parseInt(parts[2]); | ||
int hoursLyRate = Integer.parseInt(parts[3]); |
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.
There is a typo in the variable name hoursLyRate
. It should be hourlyRate
to accurately reflect the meaning of the variable.
String employeeName = parts[1]; | ||
int hoursWorked = Integer.parseInt(parts[2]); | ||
int hoursLyRate = Integer.parseInt(parts[3]); | ||
if (workDate.isBefore(from) || workDate.isAfter(to)) { |
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 workDate.isBefore(from) || workDate.isAfter(to)
excludes the boundary dates. If the intention is to include the start and end dates in the range, consider using workDate.isBefore(from) || workDate.isAfter(to)
.
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.
Review Summary
Great job on addressing the issues from the previous review! 🎉 Your code is mostly well-structured and effectively implements the salary calculation logic. Here are some key points and suggestions for further improvement:
-
Boundary Date Logic: You've successfully corrected the logic to include the boundary dates in the salary calculation. This ensures that employees working on the start or end dates are accounted for, which is crucial for accurate calculations.
-
Variable Name Typo: The variable name
hourlyRate
is now consistently used throughout your code, replacing the previous typohoursLyRate
. This change enhances the clarity and readability of your code.
Your code now meets the task requirements and constraints. While the decision is to APPROVE your Pull Request to help you move forward with your learning, it's important to continuously review and refine your code. Addressing critical issues promptly will help you avoid similar problems in the future.
Keep up the great work, and continue to learn from each iteration! 🚀
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
String employeeName = parts[1]; | ||
int hoursWorked = Integer.parseInt(parts[2]); | ||
int hourlyRate = Integer.parseInt(parts[3]); | ||
if (workDate.isBefore(from) || workDate.isAfter(to)) { |
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 current condition if (workDate.isBefore(from) || workDate.isAfter(to))
excludes the boundary dates. To include the start and end dates, you should adjust the condition to if (workDate.isBefore(from) || workDate.isAfter(to))
to if (workDate.isBefore(from) || workDate.isAfter(to))
.
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.
Please make sure you don't have any issues mentioned here
DateTimeFOrmatter, array indexes - should be constants, use only two for loops
StringBuilder report = new StringBuilder(); | ||
report.append("Report for period ") |
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.
StringBuilder report = new StringBuilder(); | |
report.append("Report for period ") | |
StringBuilder report = new StringBuilder() | |
.append("Report for period ") |
you can use object right after it's creation too
for (int i = 0; i < names.length; i++) { | ||
|
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.
for (int i = 0; i < names.length; i++) { | |
for (int i = 0; i < names.length; i++) { |
better leave empty space before loop
No description provided.