full groups statistics

This commit is contained in:
Filip Izydorczyk
2021-01-21 16:22:14 +01:00
parent a910709798
commit bfa8eb6e3e
3 changed files with 66 additions and 0 deletions

View File

@ -1,6 +1,7 @@
package com.plannaplan.services;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
@ -153,4 +154,22 @@ public class GroupService {
return response;
}
/**
* @return amount of groups with full capacity taken
*/
public Integer getFullgroupsAmmount() {
Integer response = 0;
final Iterator<Groups> groups = this.repo.findAll().iterator();
while (groups.hasNext()) {
final Groups group = groups.next();
if (group.getCapacity() <= group.getRegisteredStudents().size()) {
response += 1;
}
}
return response;
}
}