repaired places failing
This commit is contained in:
parent
78ed2f75f3
commit
c2c82b75ba
@ -5,6 +5,7 @@ import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.function.Function;
|
||||
|
||||
import com.plannaplan.entities.Groups;
|
||||
import com.plannaplan.repositories.GroupRepository;
|
||||
@ -63,8 +64,18 @@ public class GroupService {
|
||||
public HashMap<Long, Integer> getTakenPlaces(List<Groups> groups) {
|
||||
HashMap<Long, Integer> response = new HashMap<>();
|
||||
|
||||
List<Object[]> respoonses = this.repo.getAssignedAmounts(
|
||||
groups.stream().filter(Objects::nonNull).map(Groups::getId).collect(Collectors.toList()));
|
||||
// List<Object[]> respoonses = this.repo.getAssignedAmounts(
|
||||
// groups.stream().filter(Objects::nonNull).map(Groups::getId).collect(Collectors.toList()));
|
||||
|
||||
List<Object[]> respoonses = this.repo
|
||||
.getAssignedAmounts(groups.stream().filter(Objects::nonNull).map(new Function<Groups, Long>() {
|
||||
@Override
|
||||
public Long apply(Groups p) {
|
||||
final Long id = p.getId();
|
||||
response.put(id, 0);
|
||||
return id;
|
||||
}
|
||||
}).collect(Collectors.toList()));
|
||||
|
||||
for (Object[] element : respoonses) {
|
||||
response.put(((Groups) element[0]).getId(), ((Long) element[1]).intValue());
|
||||
|
Loading…
Reference in New Issue
Block a user