Vhevkpoint implemented but stiull some errors

This commit is contained in:
BuildTools
2020-11-30 13:22:53 +01:00
parent 082b30133c
commit 78ed2f75f3
3 changed files with 53 additions and 5 deletions

View File

@ -80,20 +80,34 @@ public class GroupsMappers {
}
public static CourseWithGroupsResponse<GroupWithCapacityResponse> mapToGetCourseGroupsWithCapacityResponse(
List<Groups> groups) {
List<Groups> groups, HashMap<Long, Integer> taken) {
List<GroupWithCapacityResponse> lectures = new ArrayList<>();
List<GroupWithCapacityResponse> classes = new ArrayList<>();
groups.stream().forEach(group -> {
if (group.getType() == GroupType.CLASS) {
classes.add(new GroupWithCapacityResponse(group));
if (taken != null) {
classes.add(new GroupWithCapacityResponse(group, taken.get(group.getId())));
} else {
classes.add(new GroupWithCapacityResponse(group));
}
} else {
lectures.add(new GroupWithCapacityResponse(group));
if (taken != null) {
lectures.add(new GroupWithCapacityResponse(group, taken.get(group.getId())));
} else {
lectures.add(new GroupWithCapacityResponse(group));
}
}
});
return new CourseWithGroupsResponse<>(classes, lectures);
}
public static CourseWithGroupsResponse<GroupWithCapacityResponse> mapToGetCourseGroupsWithCapacityResponse(
List<Groups> groups) {
return GroupsMappers.mapToGetCourseGroupsWithCapacityResponse(groups, null);
}
}