Added service method tests + javadocs
This commit is contained in:
@ -54,12 +54,22 @@ public class GroupService {
|
||||
|
||||
}
|
||||
|
||||
public HashMap<Groups, Integer> getTakenPlaces(List<Groups> groups) {
|
||||
HashMap<Groups, Integer> respoonse = new HashMap<>();
|
||||
/**
|
||||
*
|
||||
* @param groups list of groups you want to get taken places ammount
|
||||
* @return HashMap<Long, Integer> where Long is group id and Integer is how many
|
||||
* places in gorup is already taken
|
||||
*/
|
||||
public HashMap<Long, Integer> getTakenPlaces(List<Groups> groups) {
|
||||
HashMap<Long, Integer> response = new HashMap<>();
|
||||
|
||||
List<Object[]> respoonse2 = this.repo.getAssignedAmounts(
|
||||
List<Object[]> respoonses = this.repo.getAssignedAmounts(
|
||||
groups.stream().filter(Objects::nonNull).map(Groups::getId).collect(Collectors.toList()));
|
||||
|
||||
return respoonse;
|
||||
for (Object[] element : respoonses) {
|
||||
response.put(((Groups) element[0]).getId(), ((Long) element[1]).intValue());
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user