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