Group capacity response places overload
This commit is contained in:
@ -31,9 +31,25 @@ public class GroupsMappers {
|
||||
return GroupsMappers.mapToDefaultResponse(groups, null);
|
||||
}
|
||||
|
||||
public static List<GroupWithCapacityResponse> mapToCapacityResponse(List<Groups> groups,
|
||||
HashMap<Long, Integer> taken) {
|
||||
// return
|
||||
// groups.stream().filter(Objects::nonNull).map(GroupWithCapacityResponse::new)
|
||||
// .collect(Collectors.toList());
|
||||
return groups.stream().filter(Objects::nonNull).map(new Function<Groups, GroupWithCapacityResponse>() {
|
||||
@Override
|
||||
public GroupWithCapacityResponse apply(Groups p) {
|
||||
if (taken != null) {
|
||||
return new GroupWithCapacityResponse(p, taken.get(p.getId()));
|
||||
} else {
|
||||
return new GroupWithCapacityResponse(p);
|
||||
}
|
||||
}
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public static List<GroupWithCapacityResponse> mapToCapacityResponse(List<Groups> groups) {
|
||||
return groups.stream().filter(Objects::nonNull).map(GroupWithCapacityResponse::new)
|
||||
.collect(Collectors.toList());
|
||||
return GroupsMappers.mapToCapacityResponse(groups, null);
|
||||
}
|
||||
|
||||
public static CourseWithGroupsResponse<GroupDefaultResponse> mapToGetCourseGroupsDefaultResponse(
|
||||
|
@ -23,6 +23,10 @@ public class GroupWithCapacityResponse extends GroupDefaultResponse {
|
||||
this(assignment.getGroup());
|
||||
}
|
||||
|
||||
public GroupWithCapacityResponse(Assignment assignment, int takenPlaces) {
|
||||
this(assignment.getGroup(), takenPlaces);
|
||||
}
|
||||
|
||||
public int getCapacity() {
|
||||
return capacity;
|
||||
}
|
||||
|
Reference in New Issue
Block a user