Skip to content

Completed the task - #1597

Open
ivanmedvedievedu wants to merge 2 commits into
mate-academy:masterfrom
ivanmedvedievedu:master
Open

Completed the task#1597
ivanmedvedievedu wants to merge 2 commits into
mate-academy:masterfrom
ivanmedvedievedu:master

Conversation

@ivanmedvedievedu

Copy link
Copy Markdown

No description provided.

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Review Summary

Your implementation is correct and meets all functional requirements. The core logic for calculating salaries and handling date ranges works properly, and you've successfully implemented the getSalaryInfo method with the right signature and behavior. However, there are a few code style issues that need to be addressed before final approval: 1. [CHECKLIST ITEM #2] DateTimeFormatter should be a private static final constant, not an instance field; 2. [CHECKLIST ITEM #7] Use System.lineSeparator() instead of hardcoded "\n" for cross-platform compatibility; 3. [CHECKLIST ITEM #9] The magic number 1 in plusDays(1) should be extracted as a named constant (e.g., ONE_DAY); 4. Checkstyle violation: Line 23 exceeds 100 characters and needs to be broken into multiple lines. These are all minor style and linting issues—the code compiles and functions correctly. The linter feedback will guide you on the exact fixes needed. Once you address these style concerns, your solution will be complete.


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

Important

Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.

Tip

If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.

Caution

Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.

Footnotes

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

import java.time.format.DateTimeFormatter;

public class SalaryInfo {
private final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd.MM.yyyy");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Checklist item #2 violated: DateTimeFormatter should be a static final constant field, not an instance field. Move it to be private static final DateTimeFormatter.

}
}

stringBuilder.append("\n").append(names[i]).append(" - ").append(sum);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Checklist item #7 violated: Use System.lineSeparator() instead of hardcoded "\n" for cross-OS compatibility.

String[] splitData = data[j].split(" ");

LocalDate thisDate = LocalDate.parse(splitData[0], formatter);
boolean hasDate = (thisDate.isAfter(startDate) && thisDate.isBefore(endDate.plusDays(1)));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Checklist item #9 violated: Magic number 1 should be extracted as a named constant rather than hardcoded in plusDays(1).

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Review Summary

Your implementation is complete and meets all requirements. The SalaryInfo class correctly implements the getSalaryInfo method with proper salary calculations, inclusive date range handling, and the required return format. All technical constraints are satisfied: LocalDate is used for date handling, StringBuilder for string concatenation, System.lineSeparator() for cross-platform compatibility, and DateTimeFormatter is properly declared as private static final. Code style guidelines are followed, including the ONE_DAY constant for magic number extraction and descriptive variable names. Your solution is ready for use.


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

Footnotes

  1. Rate AI review example

@Elena-Bruyako Elena-Bruyako left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

well done

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