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

salary #1376

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

salary #1376

wants to merge 2 commits into from

Conversation

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

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

  2. Variable Name Typo: There's a typo in the variable name hoursLyRate. It should be corrected to hourlyRate 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]);

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)) {

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

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

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

  2. Variable Name Typo: The variable name hourlyRate is now consistently used throughout your code, replacing the previous typo hoursLyRate. 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)) {

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

Copy link

@okuzan okuzan left a 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

Comment on lines +27 to +28
StringBuilder report = new StringBuilder();
report.append("Report for period ")
Copy link

Choose a reason for hiding this comment

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

Suggested change
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

Comment on lines +32 to +33
for (int i = 0; i < names.length; i++) {

Copy link

Choose a reason for hiding this comment

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

Suggested change
for (int i = 0; i < names.length; i++) {
for (int i = 0; i < names.length; i++) {

better leave empty space before loop

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.

3 participants