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

Added logic to 'getSalaryInfo' method #1077

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

Conversation

HovorukhaBohdan
Copy link

No description provided.

Copy link

@kshuryhin kshuryhin 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, but there are some points to consider

.append(dateFrom).append(" - ")
.append(dateTo);

DateTimeFormatter formatter = DateTimeFormatter.ofPattern("d.MM.yyyy");

Choose a reason for hiding this comment

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

It is recommended to make your formatter a constant field

Comment on lines 25 to 27
&& workDay.isAfter(startDate)
&& (workDay.isEqual(endDate)
|| workDay.isBefore(endDate))) {

Choose a reason for hiding this comment

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

I believe we can simplify this if statement by only checking on !isBefore and !isAfter, what do you think?

Copy link

@kshuryhin kshuryhin left a comment

Choose a reason for hiding this comment

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

Just one minor point to consider

.append(dateFrom).append(" - ")
.append(dateTo);

final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("d.MM.yyyy");

Choose a reason for hiding this comment

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

Please, make your formatter a constant (private static final and class level)

public String getSalaryInfo(String[] names, String[] data, String dateFrom, String dateTo) {
return null;
String paragraph = System.lineSeparator();
StringBuilder builder = new StringBuilder("Report for period ")

Choose a reason for hiding this comment

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

I recommend you be more specific in this case because the builder name is too generic

Comment on lines +25 to +31
if (name.equals(employeeInfo[1])
&& !workDay.isAfter(endDate)
&& !workDay.isBefore(startDate)) {
totalSalary += Integer.parseInt(employeeInfo[2])
* Integer.parseInt(employeeInfo[3]);
}
}

Choose a reason for hiding this comment

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

It's hard to understand what is stored under arrayName[someIndex] without knowing the input format, it's always better to extract such expressions in separate variables with proper names to give some context on what is actually going on

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