Schedule taken places

This commit is contained in:
Filip Izydorczyk
2020-12-29 16:36:12 +01:00
parent eecb1a6d36
commit a0570a055f
4 changed files with 47 additions and 4 deletions

View File

@ -7,6 +7,7 @@ import java.util.Optional;
import java.util.stream.Collectors;
import java.util.function.Function;
import com.plannaplan.entities.Assignment;
import com.plannaplan.entities.Groups;
import com.plannaplan.repositories.GroupRepository;
@ -30,7 +31,7 @@ public class GroupService {
return this.repo.find(time, room, capacity);
}
public Optional<Groups> find(Integer zajCykId, Integer nrGr ) {
public Optional<Groups> find(Integer zajCykId, Integer nrGr) {
return this.repo.find(zajCykId, nrGr);
}
@ -64,6 +65,16 @@ public class GroupService {
}
/**
*
* @param assingemnts list of assingemnts 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> getTakenPlacesOfAssignments(List<Assignment> assignments) {
return getTakenPlaces(assignments.stream().map(Assignment::getGroup).collect(Collectors.toList()));
}
/**
*
* @param groups list of groups you want to get taken places ammount