#117 resolve last discussion
This commit is contained in:
parent
0955388f27
commit
74d43dcd0d
@ -154,26 +154,23 @@ public class GrantService {
|
||||
public List<User> getGrantAuthors(GrantDto grantDto) {
|
||||
List<User> filteredUsers = userService.filterByAgeAndDegree(grantDto.isHasAge(), grantDto.isHasDegree());
|
||||
if (grantDto.isWasLeader()) {
|
||||
filteredUsers = filteredUsers
|
||||
.stream()
|
||||
.filter(getCompletedGrantLeaders()::contains)
|
||||
.collect(toList());
|
||||
filteredUsers = checkContains(filteredUsers, getCompletedGrantLeaders());
|
||||
}
|
||||
if (grantDto.isHasBAKPapers()) {
|
||||
filteredUsers = filteredUsers
|
||||
.stream()
|
||||
.filter(getBAKAuthors()::contains)
|
||||
.collect(toList());
|
||||
filteredUsers = checkContains(filteredUsers, getBAKAuthors());
|
||||
}
|
||||
if (grantDto.isHasScopusPapers()) {
|
||||
filteredUsers = filteredUsers
|
||||
.stream()
|
||||
.filter(getScopusAuthors()::contains)
|
||||
.collect(toList());
|
||||
filteredUsers = checkContains(filteredUsers, getScopusAuthors());
|
||||
}
|
||||
return filteredUsers;
|
||||
}
|
||||
|
||||
private List<User> checkContains(List<User> filteredUsers, List<User> checkUsers) {
|
||||
return filteredUsers.stream()
|
||||
.filter(checkUsers::contains)
|
||||
.collect(toList());
|
||||
}
|
||||
|
||||
private List<User> getCompletedGrantLeaders() {
|
||||
return grantRepository.findByStatus(Grant.GrantStatus.COMPLETED)
|
||||
.stream()
|
||||
|
Loading…
Reference in New Issue
Block a user